mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-27 20:30:40 +08:00
tidy code
This commit is contained in:
parent
f4c3c86dd1
commit
e26c3d9462
@ -11,7 +11,7 @@ type UserInfo struct {
|
|||||||
FaceUrl string `json:"faceUrl" binding:"omitempty,max=1024"`
|
FaceUrl string `json:"faceUrl" binding:"omitempty,max=1024"`
|
||||||
Gender int32 `json:"gender" binding:"omitempty,oneof=0 1 2"`
|
Gender int32 `json:"gender" binding:"omitempty,oneof=0 1 2"`
|
||||||
PhoneNumber string `json:"phoneNumber" binding:"omitempty,max=32"`
|
PhoneNumber string `json:"phoneNumber" binding:"omitempty,max=32"`
|
||||||
Birth int64 `json:"birth" binding:"omitempty,max=16"`
|
Birth int64 `json:"birth" binding:"omitempty"`
|
||||||
Email string `json:"email" binding:"omitempty,max=64"`
|
Email string `json:"email" binding:"omitempty,max=64"`
|
||||||
Ex string `json:"ex" binding:"omitempty,max=1024"`
|
Ex string `json:"ex" binding:"omitempty,max=1024"`
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,9 @@ func UserRegister(user User) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
user.CreateTime = time.Now()
|
user.CreateTime = time.Now()
|
||||||
|
if user.Birth != 0 {
|
||||||
|
user.Birth = utils.UnixSecondToTime(user.Birth)
|
||||||
|
}
|
||||||
|
|
||||||
err = dbConn.Table("user").Create(&user).Error
|
err = dbConn.Table("user").Create(&user).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -80,6 +83,9 @@ func UpdateUserInfo(user User) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if user.Birth != 0 {
|
||||||
|
user.Birth = utils.UnixSecondToTime(user.Birth)
|
||||||
|
}
|
||||||
err = dbConn.Table("user").Where("user_id=?", user.UserID).Update(&user).Error
|
err = dbConn.Table("user").Where("user_id=?", user.UserID).Update(&user).Error
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user