新增了用户病例处理
This commit is contained in:
+18
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user