作者 yangfu

密码更新修改,共创申请修改

@@ -73,9 +73,10 @@ func (srv CooperationApplicationsService) SearchCooperationApplications(applicat @@ -73,9 +73,10 @@ func (srv CooperationApplicationsService) SearchCooperationApplications(applicat
73 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 73 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
74 applicationQuery.Operator) 74 applicationQuery.Operator)
75 resultApplications, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{ 75 resultApplications, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{
76 - PageNumber: applicationQuery.PageNumber,  
77 - PageSize: applicationQuery.PageSize,  
78 - CompanyId: int(applicationQuery.Operator.CompanyId), 76 + PageNumber: applicationQuery.PageNumber,
  77 + PageSize: applicationQuery.PageSize,
  78 + //CompanyId: int(applicationQuery.Operator.CompanyId),
  79 + OrgId: applicationQuery.Operator.OrgId,
79 CooperationApplicationStatus: applicationQuery.Status, 80 CooperationApplicationStatus: applicationQuery.Status,
80 }) 81 })
81 for i := 0; i < len(resultApplications.Grid.List); i++ { 82 for i := 0; i < len(resultApplications.Grid.List); i++ {
@@ -110,7 +110,7 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery @@ -110,7 +110,7 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery
110 PageNumber: projectQuery.PageNumber, 110 PageNumber: projectQuery.PageNumber,
111 PageSize: projectQuery.PageSize, 111 PageSize: projectQuery.PageSize,
112 OrgId: projectQuery.OrgId, 112 OrgId: projectQuery.OrgId,
113 - UserBaseId: projectQuery.Operator.UserBaseId, 113 + //UserBaseId: projectQuery.Operator.UserBaseId,
114 }) 114 })
115 if err != nil { 115 if err != nil {
116 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 116 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -18,6 +18,8 @@ type ChangePasswordCommand struct { @@ -18,6 +18,8 @@ type ChangePasswordCommand struct {
18 SmsCode string `cname:"短信验证码" json:"smsCode" valid:"Required"` 18 SmsCode string `cname:"短信验证码" json:"smsCode" valid:"Required"`
19 // 新密码 19 // 新密码
20 NewPassword string `cname:"新密码" json:"newPassword" valid:"Required"` 20 NewPassword string `cname:"新密码" json:"newPassword" valid:"Required"`
  21 + // 旧密码
  22 + OldPassword string `cname:"旧密码" json:"oldPassword" valid:"Required"`
21 } 23 }
22 24
23 func (phoneAuthChangePasswordCommand *ChangePasswordCommand) Valid(validation *validation.Validation) { 25 func (phoneAuthChangePasswordCommand *ChangePasswordCommand) Valid(validation *validation.Validation) {
@@ -52,20 +52,34 @@ func (srv UserService) CheckSmsCode(smsCodeCommand *command.CheckSmsCodeCommand) @@ -52,20 +52,34 @@ func (srv UserService) CheckSmsCode(smsCodeCommand *command.CheckSmsCodeCommand)
52 //ChangePassword 修改密码 52 //ChangePassword 修改密码
53 func (srv UserService) ChangePassword(changePasswordCommand *command.ChangePasswordCommand) (interface{}, error) { 53 func (srv UserService) ChangePassword(changePasswordCommand *command.ChangePasswordCommand) (interface{}, error) {
54 smsServeGateway := sms_serve.NewHttplibHttplibSmsServe() 54 smsServeGateway := sms_serve.NewHttplibHttplibSmsServe()
55 - err := smsServeGateway.CheckSmsCode(changePasswordCommand.Phone, changePasswordCommand.SmsCode)  
56 - if err != nil {  
57 - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())  
58 - }  
59 - // 2.重置密码  
60 - creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})  
61 - _, err = creationUserGateway.AuthResetPassword(allied_creation_user.ReqAuthResetPassword{  
62 - Phone: changePasswordCommand.Phone,  
63 - Password: changePasswordCommand.NewPassword,  
64 - })  
65 - if err != nil {  
66 - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 55 + if len(changePasswordCommand.OldPassword) > 0 {
  56 + // 2.重置密码
  57 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
  58 + _, err := creationUserGateway.AuthChangePassword(allied_creation_user.ReqAuthChangePassword{
  59 + OldPassword: changePasswordCommand.OldPassword,
  60 + NewPassword: changePasswordCommand.NewPassword,
  61 + UserId: changePasswordCommand.Operator.UserId,
  62 + })
  63 + if err != nil {
  64 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  65 + }
  66 + } else {
  67 + err := smsServeGateway.CheckSmsCode(changePasswordCommand.Phone, changePasswordCommand.SmsCode)
  68 + if err != nil {
  69 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  70 + }
  71 + // 2.重置密码
  72 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
  73 + _, err = creationUserGateway.AuthResetPassword(allied_creation_user.ReqAuthResetPassword{
  74 + Phone: changePasswordCommand.Phone,
  75 + Password: changePasswordCommand.NewPassword,
  76 + })
  77 + if err != nil {
  78 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  79 + }
67 } 80 }
68 - return changePasswordCommand, nil 81 +
  82 + return struct{}{}, nil
69 } 83 }
70 84
71 //ChangePhone 修改手机号 85 //ChangePhone 修改手机号
@@ -20,7 +20,7 @@ type ( @@ -20,7 +20,7 @@ type (
20 ReqAuthChangePassword struct { 20 ReqAuthChangePassword struct {
21 NewPassword string `json:"newPassword"` 21 NewPassword string `json:"newPassword"`
22 OldPassword string `json:"oldPassword"` 22 OldPassword string `json:"oldPassword"`
23 - UserId string `json:"userId"` 23 + UserId int64 `json:"userId"`
24 } 24 }
25 25
26 DataAuthChangePassword struct { 26 DataAuthChangePassword struct {