更新用户登录

This commit is contained in:
2025-09-23 20:28:56 +08:00
parent e8302dd3d7
commit 3182008eef

View File

@@ -107,6 +107,7 @@ func UserLogin(c *gin.Context) {
Telephone: phoneInfo.PhoneNumber, Telephone: phoneInfo.PhoneNumber,
// 若还有 password、avatar_url、birthdate、bio 等字段需要赋值,可在此补充 // 若还有 password、avatar_url、birthdate、bio 等字段需要赋值,可在此补充
// 比如 Password: "默认密码"实际中密码应加密存储AvatarUrl: "默认头像地址" 等 // 比如 Password: "默认密码"实际中密码应加密存储AvatarUrl: "默认头像地址" 等
Birthdate: nil,
} }
if err := databaseInit.UserDB.Create(&newUser).Error; err != nil { if err := databaseInit.UserDB.Create(&newUser).Error; err != nil {
@@ -185,7 +186,7 @@ type UserInfo struct {
Password string `gorm:"column:password"` Password string `gorm:"column:password"`
AvatarUrl string `gorm:"column:avatar_url"` AvatarUrl string `gorm:"column:avatar_url"`
Gender int `gorm:"column:gender"` Gender int `gorm:"column:gender"`
Birthdate time.Time `gorm:"column:birthdate;type:datetime"` Birthdate *time.Time `gorm:"column:birthdate-date;type:datetime;nullable"`
CreatedTime time.Time `gorm:"column:createdtime;type:datetime"` CreatedTime time.Time `gorm:"column:createdtime;type:datetime"`
UpdatedTime time.Time `gorm:"column:updatedtime;type:datetime"` UpdatedTime time.Time `gorm:"column:updatedtime;type:datetime"`
Bio string `gorm:"column:bio"` Bio string `gorm:"column:bio"`