mirror of https://gitee.com/answerdev/answer.git
update set user avatar
This commit is contained in:
parent
90deaf027b
commit
9b6a35d88b
|
@ -86,6 +86,8 @@ error:
|
|||
other: "username is invalid"
|
||||
username_duplicate:
|
||||
other: "username is already in use"
|
||||
set_avatar:
|
||||
other: "avatar set failure"
|
||||
|
||||
report:
|
||||
spam:
|
||||
|
|
|
@ -86,6 +86,8 @@ error:
|
|||
other: "用户名无效"
|
||||
username_duplicate:
|
||||
other: "用户名已被使用"
|
||||
set_avatar:
|
||||
other: "头像设置错误"
|
||||
|
||||
report:
|
||||
spam:
|
||||
|
|
|
@ -26,6 +26,7 @@ const (
|
|||
UserNotFound = "error.user.not_found"
|
||||
UsernameInvalid = "error.user.username_invalid"
|
||||
UsernameDuplicate = "error.user.username_duplicate"
|
||||
UserSetAvatar = "error.user.set_avatar"
|
||||
EmailDuplicate = "error.email.duplicate"
|
||||
EmailVerifyUrlExpired = "error.email.verify_url_expired"
|
||||
EmailNeedToBeVerified = "error.email.need_to_be_verified"
|
||||
|
|
|
@ -82,12 +82,12 @@ func (r *GetUserResp) GetFromUserEntity(userInfo *entity.User) {
|
|||
}
|
||||
}
|
||||
|
||||
func (us *GetUserResp) AvatarInfo(AvatarJson string) string {
|
||||
if AvatarJson == "" {
|
||||
func (us *GetUserResp) AvatarInfo(avatarJson string) string {
|
||||
if avatarJson == "" {
|
||||
return ""
|
||||
}
|
||||
AvatarInfo := &AvatarInfo{}
|
||||
err := json.Unmarshal([]byte(AvatarJson), AvatarInfo)
|
||||
err := json.Unmarshal([]byte(avatarJson), AvatarInfo)
|
||||
if err != nil {
|
||||
log.Error("AvatarInfo json.Unmarshal Error", err)
|
||||
return ""
|
||||
|
|
|
@ -258,6 +258,7 @@ func (us *UserService) UpdateInfo(ctx context.Context, req *schema.UpdateInfoReq
|
|||
}
|
||||
Avatar, err := json.Marshal(req.Avatar)
|
||||
if err != nil {
|
||||
err = errors.BadRequest(reason.UserSetAvatar).WithError(err).WithStack()
|
||||
return err
|
||||
}
|
||||
userInfo := entity.User{}
|
||||
|
@ -548,7 +549,7 @@ func (us *UserService) UserChangeEmailVerify(ctx context.Context, content string
|
|||
}
|
||||
err = us.userRepo.UpdateEmail(ctx, data.UserID, data.Email)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.BadRequest(reason.UserNotFound)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue