...
|
...
|
@@ -413,6 +413,27 @@ func (svr AuthService) CompanySignUp(companySignUpCommand *command.CompanySignUp |
|
|
return companySignUpCommand, err
|
|
|
}
|
|
|
|
|
|
func (svr AuthService) UserSignUp(signUpCommand *command.UserSignUpCommand) (interface{}, error) {
|
|
|
if err := signUpCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
|
|
smsServeGateway := sms_serve.NewHttplibHttplibSmsServe()
|
|
|
err := smsServeGateway.CheckSmsCode(signUpCommand.Phone, signUpCommand.SmsCode)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
|
|
|
_, err = creationUserGateway.AuthUserSignUp(allied_creation_user.ReqAuthUserSignUp{
|
|
|
Name: signUpCommand.Name,
|
|
|
Phone: signUpCommand.Phone,
|
|
|
Password: signUpCommand.Password,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return signUpCommand, err
|
|
|
}
|
|
|
|
|
|
// ResetPassword 重置密码(找回密码)
|
|
|
func (svr AuthService) ResetPassword(resetPasswordCommand *command.ResetPasswordCommand) (interface{}, error) {
|
|
|
if err := resetPasswordCommand.ValidateCommand(); err != nil {
|
...
|
...
|
@@ -482,15 +503,9 @@ func (svr AuthService) getUserInfo(operator domain.Operator) (interface{}, error |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
resultOrg, err := creationUserGateway.OrgGet(allied_creation_user.ReqOrgGet{
|
|
|
OrgId: int(operator.OrgId),
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
var user = map[string]interface{}{
|
|
|
"userId": resultUser.UserBaseId,
|
|
|
//"publicUserId":fmt.Sprintf("%v",resultUser.UserBaseId),
|
|
|
"userId": resultUser.UserBaseId,
|
|
|
"userType": resultUser.UserType,
|
|
|
"userCode": resultUser.UserCode,
|
|
|
"userInfo": map[string]interface{}{
|
...
|
...
|
@@ -500,23 +515,32 @@ func (svr AuthService) getUserInfo(operator domain.Operator) (interface{}, error |
|
|
"userCode": resultUser.UserInfo.UserCode,
|
|
|
"email": resultUser.UserInfo.Email,
|
|
|
},
|
|
|
"department": resultUser.Department,
|
|
|
"company": map[string]interface{}{
|
|
|
"department": resultUser.Department,
|
|
|
"im": resultUser.IM,
|
|
|
"favoriteMenus": resultUser.FavoriteMenus,
|
|
|
}
|
|
|
if operator.OrgId > 0 {
|
|
|
resultOrg, err := creationUserGateway.OrgGet(allied_creation_user.ReqOrgGet{
|
|
|
OrgId: int(operator.OrgId),
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
user["org"] = map[string]interface{}{
|
|
|
"orgId": resultOrg.OrgID,
|
|
|
"orgName": resultOrg.OrgName,
|
|
|
"orgCode": resultOrg.OrgCode,
|
|
|
"companyId": resultOrg.CompanyID,
|
|
|
}
|
|
|
}
|
|
|
if resultUser.Company != nil {
|
|
|
user["company"] = map[string]interface{}{
|
|
|
"companyId": resultUser.Company.CompanyId,
|
|
|
"companyName": resultUser.Company.CompanyName,
|
|
|
"logo": resultUser.Company.Logo,
|
|
|
"systemName": resultUser.Company.SystemName,
|
|
|
"address": resultUser.Company.Address,
|
|
|
},
|
|
|
"im": resultUser.IM,
|
|
|
"org": map[string]interface{}{
|
|
|
"orgId": resultOrg.OrgID,
|
|
|
"orgName": resultOrg.OrgName,
|
|
|
"orgCode": resultOrg.OrgCode,
|
|
|
"companyId": resultOrg.CompanyID,
|
|
|
},
|
|
|
//"currentLoginOrg": resultUser.Org,
|
|
|
"favoriteMenus": resultUser.FavoriteMenus,
|
|
|
}
|
|
|
}
|
|
|
return user, nil
|
|
|
}
|
...
|
...
|
@@ -644,6 +668,7 @@ loopUser1: |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "账号不存在")
|
|
|
}
|
|
|
loginToken.UserId = int64(userBase.UserID)
|
|
|
loginToken.UserBaseId = int64(userBase.UserBaseID)
|
|
|
if userBase.UserBaseID > 0 {
|
|
|
cooperationUsers, _ := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
|
...
|
...
|
|