新增了用户病例处理

This commit is contained in:
2024-08-20 14:57:07 +08:00
parent bc13339355
commit 702e482659
14 changed files with 545 additions and 77 deletions
+18 -2
View File
@@ -686,6 +686,18 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
userData["sex"] = req.Sex
}
// 头像
if req.Avatar != "" {
avatar := utils.RemoveOssDomain(req.Avatar)
if avatar != user.Avatar {
userData["avatar"] = req.Avatar
}
} else {
if user.Avatar != "" {
userData["avatar"] = ""
}
}
// 身高
if req.Height != nil {
height := fmt.Sprintf("%d", *req.Height)
@@ -693,7 +705,9 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
userInfoData["height"] = req.Height
}
} else {
userInfoData["height"] = nil
if userInfo.Height != "" {
userInfoData["height"] = nil
}
}
// 体重
@@ -703,7 +717,9 @@ func (r *UserService) PutUser(userId int64, req requests.PutUser) (bool, error)
userInfoData["weight"] = req.Weight
}
} else {
userInfoData["weight"] = nil
if userInfo.Weight != "" {
userInfoData["weight"] = nil
}
}
// 民族id