fix(avatar): Set user info default avatar

This commit is contained in:
LinkinStars 2023-03-03 18:04:53 +08:00
parent bbba11f5b1
commit 29eaa699e5
1 changed files with 4 additions and 0 deletions

View File

@ -100,6 +100,10 @@ func (r *GetUserToSetShowResp) GetFromUserEntity(userInfo *entity.User) {
} }
avatarInfo := &AvatarInfo{} avatarInfo := &AvatarInfo{}
_ = json.Unmarshal([]byte(userInfo.Avatar), avatarInfo) _ = json.Unmarshal([]byte(userInfo.Avatar), avatarInfo)
if constant.DefaultAvatar == "gravatar" && avatarInfo.Type == "" {
avatarInfo.Type = "gravatar"
avatarInfo.Gravatar = gravatar.GetAvatarURL(userInfo.EMail)
}
// if json.Unmarshal Error avatarInfo.Type is Empty // if json.Unmarshal Error avatarInfo.Type is Empty
r.Avatar = avatarInfo r.Avatar = avatarInfo
} }