正在显示
4 个修改的文件
包含
14 行增加
和
14 行删除
| @@ -10,7 +10,7 @@ import ( | @@ -10,7 +10,7 @@ import ( | ||
| 10 | 10 | ||
| 11 | type DestroyAccountCommand struct { | 11 | type DestroyAccountCommand struct { |
| 12 | // 用户Id 用户唯一标识 | 12 | // 用户Id 用户唯一标识 |
| 13 | - UserId int64 `cname:"用户Id 用户唯一标识" json:"userId" valid:"Required"` | 13 | + Account string `cname:"账号" json:"account" valid:"Required"` |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | func (destroyAccountCommand *DestroyAccountCommand) Valid(validation *validation.Validation) { | 16 | func (destroyAccountCommand *DestroyAccountCommand) Valid(validation *validation.Validation) { |
| @@ -81,7 +81,7 @@ func (authService *AuthService) DestroyAccount(destroyAccountCommand *command.De | @@ -81,7 +81,7 @@ func (authService *AuthService) DestroyAccount(destroyAccountCommand *command.De | ||
| 81 | if err != nil { | 81 | if err != nil { |
| 82 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 82 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 83 | } | 83 | } |
| 84 | - if err := accountDestroyService.DestroyAccount(nil, destroyAccountCommand.UserId); err != nil { | 84 | + if err := accountDestroyService.DestroyAccount(nil, destroyAccountCommand.Account); err != nil { |
| 85 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 85 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 86 | } | 86 | } |
| 87 | 87 |
| @@ -4,5 +4,5 @@ import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | @@ -4,5 +4,5 @@ import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" | ||
| 4 | 4 | ||
| 5 | // PgAuthAccountDestroyService 账号注销服务 | 5 | // PgAuthAccountDestroyService 账号注销服务 |
| 6 | type PgAuthAccountDestroyService interface { | 6 | type PgAuthAccountDestroyService interface { |
| 7 | - DestroyAccount(optUser *domain.User, userId int64) error | 7 | + DestroyAccount(optUser *domain.User, userId string) error |
| 8 | } | 8 | } |
| @@ -13,21 +13,21 @@ type PgAuthAccountDestroyService struct { | @@ -13,21 +13,21 @@ type PgAuthAccountDestroyService struct { | ||
| 13 | transactionContext *pgTransaction.TransactionContext | 13 | transactionContext *pgTransaction.TransactionContext |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | -func (ptr *PgAuthAccountDestroyService) DestroyAccount(optUser *domain.User, userId int64) error { | 16 | +func (ptr *PgAuthAccountDestroyService) DestroyAccount(optUser *domain.User, account string) error { |
| 17 | // 1.查询账号记录 | 17 | // 1.查询账号记录 |
| 18 | userRepository, _ := repository.NewUserRepository(ptr.transactionContext) | 18 | userRepository, _ := repository.NewUserRepository(ptr.transactionContext) |
| 19 | - var userBaseId int64 | ||
| 20 | - if user, err := userRepository.FindOne(map[string]interface{}{"userId": userId}); err != nil { | ||
| 21 | - if err == domain.ErrorNotFound { | ||
| 22 | - return fmt.Errorf("该用户不存在") | ||
| 23 | - } | ||
| 24 | - return err | ||
| 25 | - } else { | ||
| 26 | - userBaseId = user.UserBaseId | ||
| 27 | - } | 19 | + //var userBaseId int64 |
| 20 | + //if user, err := userRepository.FindOne(map[string]interface{}{"userId": userId}); err != nil { | ||
| 21 | + // if err == domain.ErrorNotFound { | ||
| 22 | + // return fmt.Errorf("该用户不存在") | ||
| 23 | + // } | ||
| 24 | + // return err | ||
| 25 | + //} else { | ||
| 26 | + // userBaseId = user.UserBaseId | ||
| 27 | + //} | ||
| 28 | 28 | ||
| 29 | userBaseRepository, _ := repository.NewUserBaseRepository(ptr.transactionContext) | 29 | userBaseRepository, _ := repository.NewUserBaseRepository(ptr.transactionContext) |
| 30 | - userBase, err := userBaseRepository.FindOne(map[string]interface{}{"userBaseId": userBaseId}) | 30 | + userBase, err := userBaseRepository.FindOne(map[string]interface{}{"account": account}) |
| 31 | if err != nil { | 31 | if err != nil { |
| 32 | return err | 32 | return err |
| 33 | } | 33 | } |
-
请 注册 或 登录 后发表评论