正在显示
5 个修改的文件
包含
20 行增加
和
6 行删除
@@ -14,7 +14,7 @@ type ResetPhoneCommand struct { | @@ -14,7 +14,7 @@ type ResetPhoneCommand struct { | ||
14 | Operator domain.Operator `json:"-"` | 14 | Operator domain.Operator `json:"-"` |
15 | // 短信验证码 | 15 | // 短信验证码 |
16 | SmsCode string `cname:"短信验证码" json:"smsCode" valid:"Required"` | 16 | SmsCode string `cname:"短信验证码" json:"smsCode" valid:"Required"` |
17 | - OldPhone string `cname:"" json:"oldPhone" valid:"Required"` | 17 | + //OldPhone string `cname:"" json:"oldPhone" valid:"Required"` |
18 | NewPhone string `cname:"" json:"newPhone" valid:"Required"` | 18 | NewPhone string `cname:"" json:"newPhone" valid:"Required"` |
19 | } | 19 | } |
20 | 20 |
@@ -76,7 +76,7 @@ func (srv UserService) ChangePhone(resetPhoneCommand *command.ResetPhoneCommand) | @@ -76,7 +76,7 @@ func (srv UserService) ChangePhone(resetPhoneCommand *command.ResetPhoneCommand) | ||
76 | creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{}) | 76 | creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{}) |
77 | _, err = creationUserGateway.AuthResetPhone(allied_creation_user.ReqAuthResetPhone{ | 77 | _, err = creationUserGateway.AuthResetPhone(allied_creation_user.ReqAuthResetPhone{ |
78 | UserId: resetPhoneCommand.Operator.UserId, | 78 | UserId: resetPhoneCommand.Operator.UserId, |
79 | - OldPhone: resetPhoneCommand.OldPhone, | 79 | + OldPhone: resetPhoneCommand.Operator.Phone, |
80 | NewPhone: resetPhoneCommand.NewPhone, | 80 | NewPhone: resetPhoneCommand.NewPhone, |
81 | }) | 81 | }) |
82 | if err != nil { | 82 | if err != nil { |
@@ -6,4 +6,5 @@ type Operator struct { | @@ -6,4 +6,5 @@ type Operator struct { | ||
6 | CompanyId int64 `json:"companyId"` | 6 | CompanyId int64 `json:"companyId"` |
7 | OrgId int64 `json:"orgId"` | 7 | OrgId int64 `json:"orgId"` |
8 | UserBaseId int64 `json:"userBaseId"` | 8 | UserBaseId int64 `json:"userBaseId"` |
9 | + Phone string `json:"phone"` | ||
9 | } | 10 | } |
1 | package beego | 1 | package beego |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "encoding/json" | ||
5 | + "github.com/beego/beego/v2/server/web/context" | ||
4 | "os" | 6 | "os" |
5 | "strconv" | 7 | "strconv" |
6 | 8 | ||
@@ -30,4 +32,11 @@ func init() { | @@ -30,4 +32,11 @@ func init() { | ||
30 | web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors()) | 32 | web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors()) |
31 | web.InsertFilter("/*", web.BeforeExec, filters.CreateRequstLogFilter(log.Logger)) | 33 | web.InsertFilter("/*", web.BeforeExec, filters.CreateRequstLogFilter(log.Logger)) |
32 | web.InsertFilter("/*", web.AfterExec, filters.CreateResponseLogFilter(log.Logger), web.WithReturnOnOutput(false)) | 34 | web.InsertFilter("/*", web.AfterExec, filters.CreateResponseLogFilter(log.Logger), web.WithReturnOnOutput(false)) |
35 | + web.InsertFilter("/v1/app1/*", web.BeforeExec, filters.SecureHandler( | ||
36 | + filters.WithEnableCheckTimestamp(false), | ||
37 | + filters.WithOnInvalidRequest(func(ctx *context.Context) { | ||
38 | + headerData, _ := json.Marshal(ctx.Input.Context.Request.Header) | ||
39 | + log.Logger.Info("签名验证失败:" + string(headerData)) | ||
40 | + }), | ||
41 | + )) | ||
33 | } | 42 | } |
@@ -37,10 +37,14 @@ func (controller *baseController) GetOrgId() int64 { | @@ -37,10 +37,14 @@ func (controller *baseController) GetOrgId() int64 { | ||
37 | } | 37 | } |
38 | 38 | ||
39 | func (controller *baseController) GetOperator() domain.Operator { | 39 | func (controller *baseController) GetOperator() domain.Operator { |
40 | + token := controller.Ctx.Input.Header("X-Mmm-Accesstoken") | ||
41 | + loginToken := &domain.LoginToken{} | ||
42 | + loginToken.ParseToken(token) | ||
40 | return domain.Operator{ | 43 | return domain.Operator{ |
41 | - UserId: 9, | ||
42 | - CompanyId: 23, | ||
43 | - OrgId: 45, | ||
44 | - UserBaseId: 5, | 44 | + UserId: loginToken.UserId, |
45 | + CompanyId: loginToken.CompanyId, | ||
46 | + OrgId: loginToken.OrgId, | ||
47 | + UserBaseId: loginToken.UserBaseId, | ||
48 | + Phone: loginToken.Account, | ||
45 | } | 49 | } |
46 | } | 50 | } |
-
请 注册 或 登录 后发表评论