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.

33 lines
696 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package Handler
import (
"dsData/CheckHandler"
"github.com/gin-gonic/gin"
"net/http"
)
/**
功能:将权限校验的东西放在这里进行
作者:黄海
时间2020-01-22
*/
func AuthorizeHandler() 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()
}
//检查通过
c.Next()
}
}