Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway into dev
正在显示
9 个修改的文件
包含
47 行增加
和
9 行删除
@@ -8,15 +8,22 @@ import ( | @@ -8,15 +8,22 @@ import ( | ||
8 | 8 | ||
9 | type SendSmsCodeCommand struct { | 9 | type SendSmsCodeCommand struct { |
10 | Phone string `json:"phone" valid:"Required"` | 10 | Phone string `json:"phone" valid:"Required"` |
11 | + // 0:无 1:需要账号存在于账号系统内,才能发送验证码 | ||
12 | + Flag int `json:"flag"` | ||
13 | + // [1:登录][2:修改密码][3:找回密码][4:注册][5:修改手机号] | ||
14 | + Action int `json:"action"` | ||
11 | } | 15 | } |
12 | 16 | ||
13 | -func (orgAddCommand *SendSmsCodeCommand) Valid(validation *validation.Validation) { | 17 | +func (cmd *SendSmsCodeCommand) Valid(validation *validation.Validation) { |
14 | 18 | ||
15 | } | 19 | } |
16 | 20 | ||
17 | -func (orgAddCommand *SendSmsCodeCommand) ValidateCommand() error { | 21 | +func (cmd *SendSmsCodeCommand) ValidateCommand() error { |
18 | valid := validation.Validation{} | 22 | valid := validation.Validation{} |
19 | - b, err := valid.Valid(orgAddCommand) | 23 | + b, err := valid.Valid(cmd) |
24 | + if cmd.Action == 1 || cmd.Action == 2 || cmd.Action == 3 { | ||
25 | + cmd.Flag = 1 | ||
26 | + } | ||
20 | if err != nil { | 27 | if err != nil { |
21 | return err | 28 | return err |
22 | } | 29 | } |
@@ -171,6 +171,18 @@ func (svr AuthService) AuthLoginQrcodeBinding(bindingCmd *command.QrcodeBindingC | @@ -171,6 +171,18 @@ func (svr AuthService) AuthLoginQrcodeBinding(bindingCmd *command.QrcodeBindingC | ||
171 | 171 | ||
172 | //SendSmsCaptcha 发送验证码短信 | 172 | //SendSmsCaptcha 发送验证码短信 |
173 | func (svr AuthService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand) error { | 173 | func (svr AuthService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand) error { |
174 | + if err := smsCodeCommand.ValidateCommand(); err != nil { | ||
175 | + return application.ThrowError(application.ARG_ERROR, err.Error()) | ||
176 | + } | ||
177 | + if smsCodeCommand.Flag == 1 { | ||
178 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{}) | ||
179 | + userBase, err := creationUserGateway.AuthUserBaseInfo(allied_creation_user.ReqAuthUserBase{ | ||
180 | + Account: smsCodeCommand.Phone, | ||
181 | + }) | ||
182 | + if err != nil || userBase.UserInfo.Phone != smsCodeCommand.Phone { | ||
183 | + return application.ThrowError(application.TRANSACTION_ERROR, "输入的手机号不是平台用户,请重新输入") | ||
184 | + } | ||
185 | + } | ||
174 | smsServeGateway := sms_serve.NewHttplibHttplibSmsServe() | 186 | smsServeGateway := sms_serve.NewHttplibHttplibSmsServe() |
175 | err := smsServeGateway.SendSms(smsCodeCommand.Phone) | 187 | err := smsServeGateway.SendSms(smsCodeCommand.Phone) |
176 | if err != nil { | 188 | if err != nil { |
@@ -11,7 +11,7 @@ type SearchDividendContractsCommand struct { | @@ -11,7 +11,7 @@ type SearchDividendContractsCommand struct { | ||
11 | //操作人 | 11 | //操作人 |
12 | Operator domain.Operator `json:"-"` | 12 | Operator domain.Operator `json:"-"` |
13 | // 查询偏离量 | 13 | // 查询偏离量 |
14 | - PageNumber int `json:"pageIndex" valid:"Required"` | 14 | + PageNumber int `json:"pageNumber" valid:"Required"` |
15 | // 查询限制 | 15 | // 查询限制 |
16 | PageSize int `json:"pageSize" valid:"Required"` | 16 | PageSize int `json:"pageSize" valid:"Required"` |
17 | //审核状态 | 17 | //审核状态 |
@@ -14,8 +14,10 @@ type SearchDividendsEstimatesCommand struct { | @@ -14,8 +14,10 @@ type SearchDividendsEstimatesCommand struct { | ||
14 | PageNumber int `json:"pageIndex" valid:"Required"` | 14 | PageNumber int `json:"pageIndex" valid:"Required"` |
15 | // 查询限制 | 15 | // 查询限制 |
16 | PageSize int `json:"pageSize" valid:"Required"` | 16 | PageSize int `json:"pageSize" valid:"Required"` |
17 | - //审核状态 | 17 | + //状态 |
18 | Status int `json:"status"` | 18 | Status int `json:"status"` |
19 | + // 组织Id | ||
20 | + OrgId int64 `json:"orgId" valid:"Required"` | ||
19 | } | 21 | } |
20 | 22 | ||
21 | func (cmd *SearchDividendsEstimatesCommand) Valid(validation *validation.Validation) { | 23 | func (cmd *SearchDividendsEstimatesCommand) Valid(validation *validation.Validation) { |
@@ -26,7 +26,11 @@ func (srv CompanyStatisticsService) SearchDividendContracts(cmd *command.SearchD | @@ -26,7 +26,11 @@ func (srv CompanyStatisticsService) SearchDividendContracts(cmd *command.SearchD | ||
26 | cmd.OrgId = cmd.Operator.OrgId | 26 | cmd.OrgId = cmd.Operator.OrgId |
27 | gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | 27 | gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( |
28 | cmd.Operator) | 28 | cmd.Operator) |
29 | - result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchContractDividends, cmd) | 29 | + result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchContractDividends, map[string]interface{}{ |
30 | + "offset": cmd.PageNumber * cmd.PageSize, | ||
31 | + "limit": cmd.PageSize, | ||
32 | + "orgId": cmd.Operator.OrgId, | ||
33 | + }) | ||
30 | if err != nil { | 34 | if err != nil { |
31 | return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 35 | return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
32 | } | 36 | } |
@@ -58,8 +58,8 @@ func (srv PersonDividendsService) SearchDividendsEstimates(cmd *command.SearchDi | @@ -58,8 +58,8 @@ func (srv PersonDividendsService) SearchDividendsEstimates(cmd *command.SearchDi | ||
58 | gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | 58 | gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( |
59 | cmd.Operator) | 59 | cmd.Operator) |
60 | result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchDividendsEstimates, map[string]interface{}{ | 60 | result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchDividendsEstimates, map[string]interface{}{ |
61 | - "companyId": cmd.Operator.CompanyId, | ||
62 | - //"orgId":cmd.Operator.OrgId, | 61 | + //"companyId": cmd.Operator.CompanyId, |
62 | + "orgId": cmd.OrgId, | ||
63 | "userBaseId": cmd.Operator.UserBaseId, | 63 | "userBaseId": cmd.Operator.UserBaseId, |
64 | "dividendsAccountStatus": cmd.Status, | 64 | "dividendsAccountStatus": cmd.Status, |
65 | "offset": (cmd.PageNumber - 1) * cmd.PageSize, | 65 | "offset": (cmd.PageNumber - 1) * cmd.PageSize, |
@@ -8,6 +8,8 @@ import ( | @@ -8,6 +8,8 @@ import ( | ||
8 | 8 | ||
9 | type SendSmsCodeCommand struct { | 9 | type SendSmsCodeCommand struct { |
10 | Phone string `json:"phone" valid:"Required"` | 10 | Phone string `json:"phone" valid:"Required"` |
11 | + // 0:无 1:需要账号存在于账号系统内,才能发送验证码 | ||
12 | + Flag int `json:"flag"` | ||
11 | } | 13 | } |
12 | 14 | ||
13 | func (orgAddCommand *SendSmsCodeCommand) Valid(validation *validation.Validation) { | 15 | func (orgAddCommand *SendSmsCodeCommand) Valid(validation *validation.Validation) { |
@@ -19,6 +19,15 @@ type UserService struct { | @@ -19,6 +19,15 @@ type UserService struct { | ||
19 | 19 | ||
20 | //SendSmsCaptcha 发送验证码短信 | 20 | //SendSmsCaptcha 发送验证码短信 |
21 | func (srv UserService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand) error { | 21 | func (srv UserService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand) error { |
22 | + if smsCodeCommand.Flag == 1 { | ||
23 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{}) | ||
24 | + userBase, err := creationUserGateway.AuthUserBaseInfo(allied_creation_user.ReqAuthUserBase{ | ||
25 | + Account: smsCodeCommand.Phone, | ||
26 | + }) | ||
27 | + if err != nil || userBase.UserInfo.Phone != smsCodeCommand.Phone { | ||
28 | + return application.ThrowError(application.TRANSACTION_ERROR, "输入的手机号不是平台用户,请重新输入") | ||
29 | + } | ||
30 | + } | ||
22 | smsServeGateway := sms_serve.NewHttplibHttplibSmsServe() | 31 | smsServeGateway := sms_serve.NewHttplibHttplibSmsServe() |
23 | err := smsServeGateway.SendSms(smsCodeCommand.Phone) | 32 | err := smsServeGateway.SendSms(smsCodeCommand.Phone) |
24 | if err != nil { | 33 | if err != nil { |
@@ -34,7 +34,9 @@ func init() { | @@ -34,7 +34,9 @@ func init() { | ||
34 | filters.SecureKeyMap["token"] = "x-mmm-accesstoken" | 34 | filters.SecureKeyMap["token"] = "x-mmm-accesstoken" |
35 | web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors()) | 35 | web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors()) |
36 | web.InsertFilter("/*", web.BeforeRouter, filters.CreateRequstLogFilter(log.Logger)) | 36 | web.InsertFilter("/*", web.BeforeRouter, filters.CreateRequstLogFilter(log.Logger)) |
37 | - web.InsertFilter("/*", web.BeforeExec, middleware.CheckAccessToken2()) | 37 | + web.InsertFilter("/v1/web/*", web.BeforeExec, middleware.CheckAccessToken2()) |
38 | + web.InsertFilter("/v1/app/*", web.BeforeExec, middleware.CheckAccessToken2()) | ||
39 | + web.InsertFilter("/v1/user/*", web.BeforeExec, middleware.CheckAccessToken2()) | ||
38 | web.InsertFilter("/*", web.AfterExec, filters.CreateResponseLogFilter(log.Logger), web.WithReturnOnOutput(false)) | 40 | web.InsertFilter("/*", web.AfterExec, filters.CreateResponseLogFilter(log.Logger), web.WithReturnOnOutput(false)) |
39 | web.InsertFilter("/v1/app11/*", web.BeforeExec, filters.SecureHandler( | 41 | web.InsertFilter("/v1/app11/*", web.BeforeExec, filters.SecureHandler( |
40 | filters.WithEnableCheckTimestamp(false), | 42 | filters.WithEnableCheckTimestamp(false), |
-
请 注册 或 登录 后发表评论