|
@@ -37,22 +37,14 @@ func Auth(settingObj cfacade.ProfileJSON) gin.HandlerFunc {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if result != constant.AdminAccess {
|
|
|
- // 获取请求URL
|
|
|
- url := c.Request.URL.Path
|
|
|
- s, err := mdb.RDB.HGet(context.Background(), common.GetTokenKey(tokenString), url).Result()
|
|
|
- if err != nil {
|
|
|
- mhayaLogger.Warnf("Auth HGet s error: %s", err.Error())
|
|
|
- common.PackUnauthorizedResult(c, code.InternalError, "")
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- // 检查是否有权限
|
|
|
- if s == "" {
|
|
|
- common.PackUnauthorizedResult(c, code.UnauthorizedError, "token is no auth")
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
+ // 获取请求URL
|
|
|
+ // url := c.Request.URL.Path
|
|
|
+ // s, err := mdb.RDB.HGet(context.Background(), common.GetTokenKey(tokenString), url).Result()
|
|
|
+ // if err != nil {
|
|
|
+ // mhayaLogger.Warnf("Auth HGet s error: %s", err.Error())
|
|
|
+ // common.PackUnauthorizedResult(c, code.InternalError, "")
|
|
|
+ // return
|
|
|
+ // }
|
|
|
|
|
|
ss, err := mdb.RDB.HGet(context.Background(), common.GetTokenKey(tokenString), constant.AdminAccess).Result()
|
|
|
if err != nil {
|
|
@@ -62,7 +54,7 @@ func Auth(settingObj cfacade.ProfileJSON) gin.HandlerFunc {
|
|
|
}
|
|
|
|
|
|
// 检查是否有权限
|
|
|
- if ss == "" {
|
|
|
+ if ss == "" && result == "" {
|
|
|
common.PackUnauthorizedResult(c, code.UnauthorizedError, "token is no auth")
|
|
|
return
|
|
|
}
|