This commit is contained in:
aozhiwei 2024-11-05 14:49:18 +08:00
parent b002811a82
commit b07bf89431
3 changed files with 17 additions and 7 deletions

View File

@ -33,6 +33,10 @@ func (this *UserApi) Login(c *gin.Context) {
user.Dice = 0
user.CreateTime = q5.ToInt32(nowTime)
user.ModifyTime = q5.ToInt32(nowTime)
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Create(user); result.Error != nil {
f5.RspErr(c, 500, "server internal error")
return
}
}
userVo.FromModel(user)
c.JSON(200, userVo)

View File

@ -1,7 +1,7 @@
package model
type User struct {
Idx int64 `gorm:"column:idx"`
Idx int64 `gorm:"column:idx;AUTO_INCREMENT"`
AccountId string `gorm:"column:account_id"`
Avatar string `gorm:"column:avatar"`
NickName string `gorm:"column:nickname"`

View File

@ -14,4 +14,10 @@ type User struct {
}
func (this *User) FromModel(m *model.User) {
this.AccountId = m.AccountId
this.NickName = m.NickName
this.Avatar = m.Avatar
this.Score = m.Score
this.HourlyEarnings = "0"
this.Dice = 0
}