作者 tangxuhui
... ... @@ -73,9 +73,10 @@ func (srv CooperationApplicationsService) SearchCooperationApplications(applicat
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
applicationQuery.Operator)
resultApplications, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{
PageNumber: applicationQuery.PageNumber,
PageSize: applicationQuery.PageSize,
CompanyId: int(applicationQuery.Operator.CompanyId),
PageNumber: applicationQuery.PageNumber,
PageSize: applicationQuery.PageSize,
//CompanyId: int(applicationQuery.Operator.CompanyId),
OrgId: applicationQuery.Operator.OrgId,
CooperationApplicationStatus: applicationQuery.Status,
})
for i := 0; i < len(resultApplications.Grid.List); i++ {
... ...
... ... @@ -110,7 +110,7 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery
PageNumber: projectQuery.PageNumber,
PageSize: projectQuery.PageSize,
OrgId: projectQuery.OrgId,
UserBaseId: projectQuery.Operator.UserBaseId,
//UserBaseId: projectQuery.Operator.UserBaseId,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -18,6 +18,8 @@ type ChangePasswordCommand struct {
SmsCode string `cname:"短信验证码" json:"smsCode" valid:"Required"`
// 新密码
NewPassword string `cname:"新密码" json:"newPassword" valid:"Required"`
// 旧密码
OldPassword string `cname:"旧密码" json:"oldPassword" valid:"Required"`
}
func (phoneAuthChangePasswordCommand *ChangePasswordCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -52,20 +52,34 @@ func (srv UserService) CheckSmsCode(smsCodeCommand *command.CheckSmsCodeCommand)
//ChangePassword 修改密码
func (srv UserService) ChangePassword(changePasswordCommand *command.ChangePasswordCommand) (interface{}, error) {
smsServeGateway := sms_serve.NewHttplibHttplibSmsServe()
err := smsServeGateway.CheckSmsCode(changePasswordCommand.Phone, changePasswordCommand.SmsCode)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
// 2.重置密码
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
_, err = creationUserGateway.AuthResetPassword(allied_creation_user.ReqAuthResetPassword{
Phone: changePasswordCommand.Phone,
Password: changePasswordCommand.NewPassword,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
if len(changePasswordCommand.OldPassword) > 0 {
// 2.重置密码
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
_, err := creationUserGateway.AuthChangePassword(allied_creation_user.ReqAuthChangePassword{
OldPassword: changePasswordCommand.OldPassword,
NewPassword: changePasswordCommand.NewPassword,
UserId: changePasswordCommand.Operator.UserId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
} else {
err := smsServeGateway.CheckSmsCode(changePasswordCommand.Phone, changePasswordCommand.SmsCode)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
// 2.重置密码
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
_, err = creationUserGateway.AuthResetPassword(allied_creation_user.ReqAuthResetPassword{
Phone: changePasswordCommand.Phone,
Password: changePasswordCommand.NewPassword,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
}
return changePasswordCommand, nil
return struct{}{}, nil
}
//ChangePhone 修改手机号
... ...
... ... @@ -20,7 +20,7 @@ type (
ReqAuthChangePassword struct {
NewPassword string `json:"newPassword"`
OldPassword string `json:"oldPassword"`
UserId string `json:"userId"`
UserId int64 `json:"userId"`
}
DataAuthChangePassword struct {
... ...