This commit is contained in:
aozhiwei 2024-11-05 14:29:33 +08:00
parent 4cba2c04f2
commit ac06dafdde
3 changed files with 32 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import (
"main/constant"
"main/common"
"main/model"
"main/vo"
"github.com/gin-gonic/gin"
)
@ -17,13 +18,11 @@ func (this *UserApi) Login(c *gin.Context) {
return
}
user := new(model.User)
userVo := new(vo.User)
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(user.TableName()).Take(
user, "account_id = ?", s.GetAccountId()); result.Error != nil {
if result.Error != nil {
}
f5.RspErr(c, 500, "server internal error")
return
}
c.JSON(200, userVo)
}

View File

@ -0,0 +1,22 @@
package vo
type Base struct {
ErrCode int32 `json:"errcode"`
ErrMsg string `json:"errcmsg"`
Award *Award `json:"award"`
SideEffect *Award `json:"side_effect"`
}
type AwardItem struct {
ItemId int32 `json:"item_id"`
ItemNum int32 `json:"item_num"`
}
type Award struct {
Items []AwardItem `json:"items"`
}
type SideEffect struct {
User *User `json:"user_info"`
Effects []string `json:"side_effect"`
}

View File

@ -1,5 +1,9 @@
package vo
import (
"main/model"
)
type User struct {
AccountId string `json:"account_id"`
NickName string `json:"nickname"`
@ -8,3 +12,6 @@ type User struct {
HourlyEarnings string `json:"hourly_earnings"`
Dice int32 `gorm:"json:dice"`
}
func (this *User) FromModel(m *model.User) {
}