package middleware import ( "github.com/gin-gonic/gin" "hongze/hongze_yb/controller/response" "hongze/hongze_yb/services/company" "hongze/hongze_yb/services/user" ) // CheckBaseAuth 基本权限校验 func CheckBaseAuth() gin.HandlerFunc { return func(c *gin.Context) { userInfo := user.GetInfoByClaims(c) ok, checkInfo, _, err := company.CheckBaseFiccPermission(userInfo.CompanyID, int(userInfo.UserID)) if err != nil { response.FailMsg("用户权限验证失败", "CheckBaseAuth-用户权限验证失败" + err.Error(), c) c.Abort() return } if !ok { response.AuthError(checkInfo, "暂无权限", c) c.Abort() return } c.Next() } }