Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway into dev
正在显示
8 个修改的文件
包含
35 行增加
和
56 行删除
@@ -10,13 +10,15 @@ import ( | @@ -10,13 +10,15 @@ import ( | ||
10 | 10 | ||
11 | type ResetPasswordCommand struct { | 11 | type ResetPasswordCommand struct { |
12 | // 手机号码 | 12 | // 手机号码 |
13 | - // Phone string `cname:"手机号码" json:"phone" valid:"Required"` | 13 | + Phone string `cname:"手机号码" json:"phone"` |
14 | // 密码 | 14 | // 密码 |
15 | Password string `cname:"密码" json:"newPassword"` | 15 | Password string `cname:"密码" json:"newPassword"` |
16 | // 密码 | 16 | // 密码 |
17 | RepeatNewPassword string `cname:"密码" json:"repeatNewPassword" valid:"Required"` | 17 | RepeatNewPassword string `cname:"密码" json:"repeatNewPassword" valid:"Required"` |
18 | // 密码 | 18 | // 密码 |
19 | - SmsCodeIdentity string `cname:"密码" json:"smsCodeIdentity" valid:"Required"` | 19 | + SmsCodeIdentity string `cname:"密码" json:"smsCodeIdentity"` |
20 | + // 1:smsCodeIdentity 验证码凭证 2:smsCode 验证 | ||
21 | + SmsCode string `cname:"密码" json:"smsCode"` | ||
20 | } | 22 | } |
21 | 23 | ||
22 | func (resetPasswordCommand *ResetPasswordCommand) Valid(validation *validation.Validation) { | 24 | func (resetPasswordCommand *ResetPasswordCommand) Valid(validation *validation.Validation) { |
@@ -409,17 +409,27 @@ func (svr AuthService) ResetPassword(resetPasswordCommand *command.ResetPassword | @@ -409,17 +409,27 @@ func (svr AuthService) ResetPassword(resetPasswordCommand *command.ResetPassword | ||
409 | if err := resetPasswordCommand.ValidateCommand(); err != nil { | 409 | if err := resetPasswordCommand.ValidateCommand(); err != nil { |
410 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 410 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
411 | } | 411 | } |
412 | - //var phone string | 412 | + var phone = resetPasswordCommand.Phone |
413 | + if len(resetPasswordCommand.SmsCode) > 0 { | ||
414 | + smsServeGateway := sms_serve.NewHttplibHttplibSmsServe() | ||
415 | + err := smsServeGateway.CheckSmsCode(resetPasswordCommand.Phone, resetPasswordCommand.SmsCode) | ||
416 | + if err != nil { | ||
417 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
418 | + } | ||
419 | + } else { | ||
413 | pcc := cache.PhoneCheckCache{} | 420 | pcc := cache.PhoneCheckCache{} |
414 | var item = &cache.PhoneCheckItem{} | 421 | var item = &cache.PhoneCheckItem{} |
415 | if err := pcc.Get(resetPasswordCommand.SmsCodeIdentity, item); err != nil { | 422 | if err := pcc.Get(resetPasswordCommand.SmsCodeIdentity, item); err != nil { |
416 | log.Logger.Error(err.Error()) | 423 | log.Logger.Error(err.Error()) |
417 | return nil, application.ThrowError(application.BUSINESS_ERROR, "验证码已失效") | 424 | return nil, application.ThrowError(application.BUSINESS_ERROR, "验证码已失效") |
418 | } | 425 | } |
426 | + phone = item.Phone | ||
427 | + } | ||
428 | + | ||
419 | // 2.重置密码 | 429 | // 2.重置密码 |
420 | creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{}) | 430 | creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{}) |
421 | result, err := creationUserGateway.AuthResetPassword(allied_creation_user.ReqAuthResetPassword{ | 431 | result, err := creationUserGateway.AuthResetPassword(allied_creation_user.ReqAuthResetPassword{ |
422 | - Phone: item.Phone, | 432 | + Phone: phone, |
423 | Password: resetPasswordCommand.Password, | 433 | Password: resetPasswordCommand.Password, |
424 | }) | 434 | }) |
425 | if err != nil { | 435 | if err != nil { |
@@ -37,6 +37,7 @@ func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDicti | @@ -37,6 +37,7 @@ func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDicti | ||
37 | {"菜单", "menu"}, | 37 | {"菜单", "menu"}, |
38 | {"按钮", "button"}, | 38 | {"按钮", "button"}, |
39 | }, | 39 | }, |
40 | + "dictCode": "MenuType", | ||
40 | }) | 41 | }) |
41 | case "XTZD-001": | 42 | case "XTZD-001": |
42 | dictionaries = append(dictionaries, map[string]interface{}{ | 43 | dictionaries = append(dictionaries, map[string]interface{}{ |
@@ -48,6 +49,7 @@ func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDicti | @@ -48,6 +49,7 @@ func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDicti | ||
48 | {"4", "501~1000人"}, | 49 | {"4", "501~1000人"}, |
49 | {"5", "1000人以上"}, | 50 | {"5", "1000人以上"}, |
50 | }, | 51 | }, |
52 | + "dictCode": "XTZD-001", | ||
51 | }) | 53 | }) |
52 | case "XTZD-002": | 54 | case "XTZD-002": |
53 | dictionaries = append(dictionaries, map[string]interface{}{ | 55 | dictionaries = append(dictionaries, map[string]interface{}{ |
@@ -57,6 +59,7 @@ func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDicti | @@ -57,6 +59,7 @@ func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDicti | ||
57 | {"2", "电子行业"}, | 59 | {"2", "电子行业"}, |
58 | {"3", "纺织业"}, | 60 | {"3", "纺织业"}, |
59 | }, | 61 | }, |
62 | + "dictCode": "XTZD-002", | ||
60 | }) | 63 | }) |
61 | } | 64 | } |
62 | } | 65 | } |
@@ -10,45 +10,6 @@ import ( | @@ -10,45 +10,6 @@ import ( | ||
10 | type PersonCreditAccountService struct { | 10 | type PersonCreditAccountService struct { |
11 | } | 11 | } |
12 | 12 | ||
13 | -// CreditAccountGet 企业的账期结算明细 | ||
14 | -//func (srv PersonCreditAccountService) CreditAccountGet(cmd *command.CreditAccountGetCommand) (interface{}, error) { | ||
15 | -// gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | ||
16 | -// cmd.Operator) | ||
17 | -// resultMenu, err := gateway.CreditAccountGet(allied_creation_cooperation.ReqCreditAccountGet{ | ||
18 | -// CreditAccountId: cmd.CreditAccountId, | ||
19 | -// }) | ||
20 | -// if err != nil { | ||
21 | -// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
22 | -// } | ||
23 | -// return resultMenu, nil | ||
24 | -//} | ||
25 | - | ||
26 | -//// CreditAccountDelete 企业的账期结算删除 | ||
27 | -//func (srv PersonCreditAccountService) CreditAccountDelete(cmd *command.CreditAccountGetCommand) (interface{}, error) { | ||
28 | -// gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | ||
29 | -// cmd.Operator) | ||
30 | -// resultMenu, err := gateway.CreditAccountRemove(allied_creation_cooperation.ReqCreditAccountRemove{ | ||
31 | -// CreditAccountId: cmd.CreditAccountId, | ||
32 | -// }) | ||
33 | -// if err != nil { | ||
34 | -// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
35 | -// } | ||
36 | -// return resultMenu, nil | ||
37 | -//} | ||
38 | -// | ||
39 | -//// CreditAccountPay 企业的账期结算支付 | ||
40 | -//func (srv PersonCreditAccountService) CreditAccountPay(cmd *command.CreditAccountPayCommand) (interface{}, error) { | ||
41 | -// gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | ||
42 | -// cmd.Operator) | ||
43 | -// resultMenu, err := gateway.CreditAccountsPay(allied_creation_cooperation.ReqCreditAccountsPay{ | ||
44 | -// CreditAccountId: cmd.CreditAccountId, | ||
45 | -// }) | ||
46 | -// if err != nil { | ||
47 | -// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
48 | -// } | ||
49 | -// return resultMenu, nil | ||
50 | -//} | ||
51 | - | ||
52 | // CreditAccountPaySearch 企业分红结算支付记录 | 13 | // CreditAccountPaySearch 企业分红结算支付记录 |
53 | func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) { | 14 | func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) { |
54 | gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | 15 | gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( |
@@ -105,11 +105,6 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics | @@ -105,11 +105,6 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics | ||
105 | }, nil | 105 | }, nil |
106 | } | 106 | } |
107 | 107 | ||
108 | -// CooperationPersonStatistics TODO:共创人员统计(共创人员明细) | ||
109 | -func (srv CompanyStatisticsService) CooperationPersonStatistics(userMenusCommand *command.CooperationPersonStatisticsCommand) (interface{}, error) { | ||
110 | - return map[string]interface{}{}, nil | ||
111 | -} | ||
112 | - | ||
113 | // GoodsStatistics TODO:产品统计排行榜 年月榜 | 108 | // GoodsStatistics TODO:产品统计排行榜 年月榜 |
114 | func (srv CompanyStatisticsService) GoodsStatistics(userMenusCommand *command.GoodsStatisticsCommand) (int64, interface{}, error) { | 109 | func (srv CompanyStatisticsService) GoodsStatistics(userMenusCommand *command.GoodsStatisticsCommand) (int64, interface{}, error) { |
115 | type rankItem struct { | 110 | type rankItem struct { |
@@ -131,7 +126,7 @@ func (srv CompanyStatisticsService) GoodsStatistics(userMenusCommand *command.Go | @@ -131,7 +126,7 @@ func (srv CompanyStatisticsService) GoodsStatistics(userMenusCommand *command.Go | ||
131 | return 5, items, nil | 126 | return 5, items, nil |
132 | } | 127 | } |
133 | 128 | ||
134 | -// CooperationDividendsStatistics TODO:公司共创人员列表(分红支出统计) | 129 | +// CooperationDividendsStatistics TODO:公司共创人员列表 |
135 | func (srv CompanyStatisticsService) CooperationDividendsStatistics(userMenusCommand *command.CooperationDividendsStatisticsCommand) (int64, interface{}, error) { | 130 | func (srv CompanyStatisticsService) CooperationDividendsStatistics(userMenusCommand *command.CooperationDividendsStatisticsCommand) (int64, interface{}, error) { |
136 | type cooperationDividendItem struct { | 131 | type cooperationDividendItem struct { |
137 | CooperationTime int64 `json:"cooperationTime"` | 132 | CooperationTime int64 `json:"cooperationTime"` |
@@ -166,3 +161,8 @@ func (srv CompanyStatisticsService) CooperationDividendsStatistics(userMenusComm | @@ -166,3 +161,8 @@ func (srv CompanyStatisticsService) CooperationDividendsStatistics(userMenusComm | ||
166 | } | 161 | } |
167 | return 5, results, nil | 162 | return 5, results, nil |
168 | } | 163 | } |
164 | + | ||
165 | +// CooperationPersonStatistics TODO:共创人员统计(共创人员明细) | ||
166 | +func (srv CompanyStatisticsService) CooperationPersonStatistics(userMenusCommand *command.CooperationPersonStatisticsCommand) (interface{}, error) { | ||
167 | + return map[string]interface{}{}, nil | ||
168 | +} |
@@ -33,8 +33,8 @@ func init() { | @@ -33,8 +33,8 @@ func init() { | ||
33 | } | 33 | } |
34 | filters.SecureKeyMap["token"] = "x-mmm-accesstoken" | 34 | filters.SecureKeyMap["token"] = "x-mmm-accesstoken" |
35 | //TODO:token验证改为 /v1 | 35 | //TODO:token验证改为 /v1 |
36 | - web.InsertFilterChain("/v1/app11/*", middleware.CheckAccessToken) | ||
37 | web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors()) | 36 | web.InsertFilter("/*", web.BeforeRouter, filters.AllowCors()) |
37 | + web.InsertFilterChain("/v1/app1/*", middleware.CheckAccessToken) | ||
38 | web.InsertFilter("/*", web.BeforeRouter, filters.CreateRequstLogFilter(log.Logger)) | 38 | web.InsertFilter("/*", web.BeforeRouter, filters.CreateRequstLogFilter(log.Logger)) |
39 | web.InsertFilter("/*", web.AfterExec, filters.CreateResponseLogFilter(log.Logger), web.WithReturnOnOutput(false)) | 39 | web.InsertFilter("/*", web.AfterExec, filters.CreateResponseLogFilter(log.Logger), web.WithReturnOnOutput(false)) |
40 | web.InsertFilter("/v1/app11/*", web.BeforeExec, filters.SecureHandler( | 40 | web.InsertFilter("/v1/app11/*", web.BeforeExec, filters.SecureHandler( |
@@ -93,12 +93,12 @@ func (controller *BaseController) GetOperator() domain.Operator { | @@ -93,12 +93,12 @@ func (controller *BaseController) GetOperator() domain.Operator { | ||
93 | OrgIds: loginToken.OrgIds, | 93 | OrgIds: loginToken.OrgIds, |
94 | } | 94 | } |
95 | // TODO:测试数据后期删除 | 95 | // TODO:测试数据后期删除 |
96 | - if op.UserId == 0 { | ||
97 | - op.UserId = 1 | ||
98 | - op.CompanyId = 1 | ||
99 | - op.OrgId = 1 | ||
100 | - op.UserBaseId = 1 | ||
101 | - } | 96 | + //if op.UserId == 0 { |
97 | + // op.UserId = 1 | ||
98 | + // op.CompanyId = 1 | ||
99 | + // op.OrgId = 1 | ||
100 | + // op.UserBaseId = 1 | ||
101 | + //} | ||
102 | // TODO:打印测试日志 | 102 | // TODO:打印测试日志 |
103 | log.Logger.Debug("operator " + json.MarshalToString(op)) | 103 | log.Logger.Debug("operator " + json.MarshalToString(op)) |
104 | return op | 104 | return op |
@@ -24,6 +24,8 @@ func CheckAccessToken(next web.FilterFunc) web.FilterFunc { | @@ -24,6 +24,8 @@ func CheckAccessToken(next web.FilterFunc) web.FilterFunc { | ||
24 | "/v1/auth/login/pwd": "", | 24 | "/v1/auth/login/pwd": "", |
25 | "/v1/auth/login/sms": "", | 25 | "/v1/auth/login/sms": "", |
26 | "/v1/auth/login/qrcode": "", | 26 | "/v1/auth/login/qrcode": "", |
27 | + "/v1/auth/org-switch": "", | ||
28 | + "/v1/user/company-orgs": "", | ||
27 | "/v1/auth/captcha-init": "", | 29 | "/v1/auth/captcha-init": "", |
28 | "/v1/auth/qrcode-init": "", | 30 | "/v1/auth/qrcode-init": "", |
29 | "/v1/auth/sms-code": "", | 31 | "/v1/auth/sms-code": "", |
@@ -31,6 +33,7 @@ func CheckAccessToken(next web.FilterFunc) web.FilterFunc { | @@ -31,6 +33,7 @@ func CheckAccessToken(next web.FilterFunc) web.FilterFunc { | ||
31 | "/v1/auth/company-sign-up": "", | 33 | "/v1/auth/company-sign-up": "", |
32 | "/v1/auth/reset-password": "", | 34 | "/v1/auth/reset-password": "", |
33 | "/v1/auth/refresh-token": "", | 35 | "/v1/auth/refresh-token": "", |
36 | + "/v1/app/cooperation-projects/person/search": "", | ||
34 | } | 37 | } |
35 | var err error | 38 | var err error |
36 | if filterUrl, err := url.Parse(ctx.Request.RequestURI); err == nil { | 39 | if filterUrl, err := url.Parse(ctx.Request.RequestURI); err == nil { |
-
请 注册 或 登录 后发表评论