You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dsMin/dsSzxy/Handler/ParameterHandler.go

30 lines
632 B

package Handler
import (
"dsSzxy/Handler/CheckHandler"
"github.com/gin-gonic/gin"
"net/http"
)
func ParameterHandler() gin.HandlerFunc {
return func(c *gin.Context) {
//检查参数的合法性
var resultStruct CheckHandler.ResultStruct
result, resultStruct := CheckHandler.IsLegal(c)
if !result {
c.JSON(http.StatusOK, gin.H{
"success": false,
"interfacename": resultStruct.InterfaceName,
"httptype": resultStruct.HttpType,
"parameter": resultStruct.Parameter,
"message": resultStruct.Message,
})
c.Abort()
return
} else {
//检查通过
c.Next()
}
}
}