mirror of https://gitee.com/answerdev/answer.git
Merge branch 'ai_update_user_avatar' into 'main'
update AvatarInfo to show img See merge request opensource/answer!129
This commit is contained in:
commit
3cde88e7d6
|
@ -73,7 +73,7 @@ type GetUserResp struct {
|
|||
|
||||
func (r *GetUserResp) GetFromUserEntity(userInfo *entity.User) {
|
||||
_ = copier.Copy(r, userInfo)
|
||||
r.Avatar = r.AvatarInfo(userInfo.Avatar)
|
||||
r.Avatar = FormatAvatarInfo(userInfo.Avatar)
|
||||
r.CreatedAt = userInfo.CreatedAt.Unix()
|
||||
r.LastLoginDate = userInfo.LastLoginDate.Unix()
|
||||
statusShow, ok := UserStatusShow[userInfo.Status]
|
||||
|
@ -103,7 +103,7 @@ func (r *GetUserToSetShowResp) GetFromUserEntity(userInfo *entity.User) {
|
|||
r.Avatar = avatarInfo
|
||||
}
|
||||
|
||||
func (us *GetUserResp) AvatarInfo(avatarJson string) string {
|
||||
func FormatAvatarInfo(avatarJson string) string {
|
||||
if avatarJson == "" {
|
||||
return ""
|
||||
}
|
||||
|
@ -172,6 +172,9 @@ type GetOtherUserInfoByUsernameResp struct {
|
|||
|
||||
func (r *GetOtherUserInfoByUsernameResp) GetFromUserEntity(userInfo *entity.User) {
|
||||
_ = copier.Copy(r, userInfo)
|
||||
Avatar := FormatAvatarInfo(userInfo.Avatar)
|
||||
r.Avatar = Avatar
|
||||
|
||||
r.CreatedAt = userInfo.CreatedAt.Unix()
|
||||
r.LastLoginDate = userInfo.LastLoginDate.Unix()
|
||||
statusShow, ok := UserStatusShow[userInfo.Status]
|
||||
|
|
|
@ -76,13 +76,12 @@ func (us *UserCommon) BatchUserBasicInfoByID(ctx context.Context, IDs []string)
|
|||
// UserBasicInfoFormat
|
||||
func (us *UserCommon) UserBasicInfoFormat(ctx context.Context, userInfo *entity.User) *schema.UserBasicInfo {
|
||||
userBasicInfo := &schema.UserBasicInfo{}
|
||||
uinfo := &schema.GetUserResp{}
|
||||
uinfo.AvatarInfo(userInfo.Avatar)
|
||||
Avatar := schema.FormatAvatarInfo(userInfo.Avatar)
|
||||
userBasicInfo.ID = userInfo.ID
|
||||
userBasicInfo.Username = userInfo.Username
|
||||
userBasicInfo.Rank = userInfo.Rank
|
||||
userBasicInfo.DisplayName = userInfo.DisplayName
|
||||
userBasicInfo.Avatar = uinfo.Avatar
|
||||
userBasicInfo.Avatar = Avatar
|
||||
userBasicInfo.Website = userInfo.Website
|
||||
userBasicInfo.Location = userInfo.Location
|
||||
userBasicInfo.IpInfo = userInfo.IPInfo
|
||||
|
|
Loading…
Reference in New Issue