style: 错误信息英文返回-framework模块

This commit is contained in:
TsMask
2023-11-08 15:00:05 +08:00
parent 267a13d3d6
commit 81138b8c22
9 changed files with 28 additions and 21 deletions

View File

@@ -2,7 +2,7 @@ package token
import (
"encoding/json"
"errors"
"fmt"
"time"
"ems.agt/src/framework/config"
@@ -124,13 +124,14 @@ func Verify(tokenString string) (jwt.MapClaims, error) {
})
if err != nil {
logger.Errorf("token String Verify : %v", err)
return nil, errors.New("无效身份授权")
// 无效身份授权
return nil, fmt.Errorf("invalid identity authorization")
}
// 如果解析负荷成功并通过签名校验
if claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {
return claims, nil
}
return nil, errors.New("token valid error")
return nil, fmt.Errorf("token valid error")
}
// LoginUser 缓存的登录用户信息