正在显示
1 个修改的文件
包含
7 行增加
和
5 行删除
1 | package controllers | 1 | package controllers |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | - "errors" | ||
5 | - | 4 | + "github.com/linmadan/egglib-go/core/application" |
6 | "github.com/linmadan/egglib-go/web/beego" | 5 | "github.com/linmadan/egglib-go/web/beego" |
7 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/auth/command" | 6 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/auth/command" |
8 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/auth/service" | 7 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/auth/service" |
@@ -75,16 +74,19 @@ func (controller *AuthController) RefreshToken() { | @@ -75,16 +74,19 @@ func (controller *AuthController) RefreshToken() { | ||
75 | func (controller *AuthController) UserInfos() { | 74 | func (controller *AuthController) UserInfos() { |
76 | tokenStr := controller.Ctx.Input.Header("x-mmm-accesstoken") | 75 | tokenStr := controller.Ctx.Input.Header("x-mmm-accesstoken") |
77 | if tokenStr == "" { //没有带token | 76 | if tokenStr == "" { //没有带token |
78 | - controller.Response(nil, errors.New("token 错误")) | 77 | + e := application.ThrowError(application.ARG_ERROR, "token 错误") |
78 | + controller.Response(nil, e) | ||
79 | return | 79 | return |
80 | } | 80 | } |
81 | userAuth, err := (&domain.UserAuth{}).ParseAccessToken(tokenStr) | 81 | userAuth, err := (&domain.UserAuth{}).ParseAccessToken(tokenStr) |
82 | if err != nil || userAuth.UserId <= 0 { | 82 | if err != nil || userAuth.UserId <= 0 { |
83 | - controller.Response(nil, errors.New("token 错误")) | 83 | + e := application.ThrowError(application.ARG_ERROR, "token 错误") |
84 | + controller.Response(nil, e) | ||
84 | return | 85 | return |
85 | } | 86 | } |
86 | if userAuth.PlatformId != constant.PLATFORM_FONT_ID { | 87 | if userAuth.PlatformId != constant.PLATFORM_FONT_ID { |
87 | - controller.Response(nil, errors.New("token 错误")) | 88 | + e := application.ThrowError(application.ARG_ERROR, "token 错误") |
89 | + controller.Response(nil, e) | ||
88 | return | 90 | return |
89 | } | 91 | } |
90 | authService := &service.AuthService{} | 92 | authService := &service.AuthService{} |
-
请 注册 或 登录 后发表评论