...
|
...
|
@@ -741,7 +741,7 @@ func (userService *UserService) UpdateUser(updateUserCommand *command.UpdateUser |
|
|
}
|
|
|
|
|
|
// 更新用户基础信息数据
|
|
|
func (userService *UserService) UpdateUsersBase(updateUsersBaseCommand *command.UpdateUsersBaseCommand) (interface{}, error) {
|
|
|
func (userService *UserService) UpdateUsersBaseOld(updateUsersBaseCommand *command.UpdateUsersBaseCommand) (interface{}, error) {
|
|
|
if err := updateUsersBaseCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -778,6 +778,40 @@ func (userService *UserService) UpdateUsersBase(updateUsersBaseCommand *command. |
|
|
return struct{}{}, nil
|
|
|
}
|
|
|
|
|
|
// 更新用户基础信息数据
|
|
|
func (userService *UserService) UpdateUsersBase(updateUsersBaseCommand *command.UpdateUsersBaseCommand) (interface{}, error) {
|
|
|
if err := updateUsersBaseCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
|
|
}
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.StartTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
userInfo := &domain.UserInfo{
|
|
|
UserName: updateUsersBaseCommand.UserName,
|
|
|
Phone: updateUsersBaseCommand.Phone,
|
|
|
Avatar: updateUsersBaseCommand.Avatar,
|
|
|
Email: updateUsersBaseCommand.Email,
|
|
|
}
|
|
|
updateUserService, _ := factory.CreatePgUpdateUserBaseService(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
if _, err = updateUserService.UpdateUserBase(nil, updateUsersBaseCommand.UserBaseId, userInfo); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
return struct{}{}, nil
|
|
|
}
|
|
|
|
|
|
func NewUserService(options map[string]interface{}) *UserService {
|
|
|
newUserService := &UserService{}
|
|
|
return newUserService
|
...
|
...
|
|