|
@@ -148,11 +148,14 @@ func (us *UserService) EditParentUser(in *command.EditParentCommand) error { |
|
@@ -148,11 +148,14 @@ func (us *UserService) EditParentUser(in *command.EditParentCommand) error { |
148
|
if err != nil {
|
148
|
if err != nil {
|
149
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
149
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
150
|
}
|
150
|
}
|
|
|
151
|
+
|
|
|
152
|
+ if in.ParentId != 0 {
|
151
|
// 上级ID是否存在
|
153
|
// 上级ID是否存在
|
152
|
_, err = userRepo.FindOne(map[string]interface{}{"id": in.ParentId})
|
154
|
_, err = userRepo.FindOne(map[string]interface{}{"id": in.ParentId})
|
153
|
if err != nil {
|
155
|
if err != nil {
|
154
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
156
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
155
|
}
|
157
|
}
|
|
|
158
|
+ }
|
156
|
user.ParentId = in.ParentId
|
159
|
user.ParentId = in.ParentId
|
157
|
|
160
|
|
158
|
if _, err = userRepo.Update(user); err != nil {
|
161
|
if _, err = userRepo.Update(user); err != nil {
|