部分重构

This commit is contained in:
2026-03-31 20:06:53 +08:00
parent 6d79836682
commit 498cc78dce
43 changed files with 6049 additions and 131 deletions
+35
View File
@@ -0,0 +1,35 @@
package handler
import (
"strconv"
"github.com/gin-gonic/gin"
)
// GetIntParam 获取整数参数
func GetIntParam(c *gin.Context, key string, defaultValue int) int {
value := c.Query(key)
if value == "" {
return defaultValue
}
intValue, err := strconv.Atoi(value)
if err != nil {
return defaultValue
}
return intValue
}
// GetUintParam 获取uint参数
func GetUintParam(c *gin.Context, key string) uint {
value := c.Param(key)
if value == "" {
return 0
}
intValue, err := strconv.Atoi(value)
if err != nil {
return 0
}
return uint(intValue)
}