|
@@ -24,6 +24,7 @@ const (
|
|
|
ILLEGALUSER = "用户信息异常"
|
|
|
UNAUTHORIZED = "请重新登录"
|
|
|
TOKENEXPIRED = "token过期"
|
|
|
+ LOGINREQURED = "重新登录"
|
|
|
FORBIDDEN = "禁止访问"
|
|
|
NOTFOUND = "未找到"
|
|
|
authorization = "Authorization"
|
|
@@ -107,7 +108,7 @@ func AuthMiddleware() web.FilterFunc {
|
|
|
if err != nil {
|
|
|
logger.Error("重置用户状态失败:%v", err)
|
|
|
}
|
|
|
- _ = ctx.JSONResp(tokenExpired())
|
|
|
+ _ = ctx.JSONResp(LoginRequired())
|
|
|
return
|
|
|
}
|
|
|
if redisToken != parts[1] {
|
|
@@ -118,7 +119,7 @@ func AuthMiddleware() web.FilterFunc {
|
|
|
if needCheckLoginStatus(path) {
|
|
|
if info.TokenType != jwt.AccessToken || info.Mobile == "-" || info.Mobile == "" {
|
|
|
logger.Error("token信息异常,当前token类型为:%v", jwt.GuestToken)
|
|
|
- _ = ctx.JSONResp(illegalUser())
|
|
|
+ _ = ctx.JSONResp(LoginRequired())
|
|
|
return
|
|
|
}
|
|
|
}
|
|
@@ -148,6 +149,14 @@ func tokenExpired() controllers.BaseResponse {
|
|
|
ErrMsg: exception.GetMsg(exception.Unauthorized),
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+func LoginRequired() controllers.BaseResponse {
|
|
|
+ return controllers.BaseResponse{
|
|
|
+ Ret: 408,
|
|
|
+ Msg: LOGINREQURED,
|
|
|
+ ErrMsg: exception.GetMsg(exception.Unauthorized),
|
|
|
+ }
|
|
|
+}
|
|
|
func illegalUser() controllers.BaseResponse {
|
|
|
return controllers.BaseResponse{
|
|
|
Ret: 401,
|