This commit is contained in:
aozhiwei 2024-11-05 17:55:08 +08:00
parent a78458ace3
commit 55f53c1d82
2 changed files with 6 additions and 4 deletions

View File

@ -21,7 +21,10 @@ func (this *UserApi) Login(c *gin.Context) {
return return
} }
user := new(model.User) user := new(model.User)
userVo := new(vo.User) rspObj := struct {
vo.BaseVo
UserInfo vo.User `json:"user_info"`
}{}
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(user.TableName()).Take( if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Table(user.TableName()).Take(
user, "account_id = ?", s.GetAccountId()); result.Error != nil && user, "account_id = ?", s.GetAccountId()); result.Error != nil &&
!errors.Is(result.Error, gorm.ErrRecordNotFound) { !errors.Is(result.Error, gorm.ErrRecordNotFound) {
@ -41,6 +44,6 @@ func (this *UserApi) Login(c *gin.Context) {
return return
} }
} }
userVo.FromModel(user) rspObj.UserInfo.FromModel(user)
c.JSON(200, userVo) c.JSON(200, rspObj)
} }

View File

@ -5,7 +5,6 @@ import (
) )
type User struct { type User struct {
BaseVo
AccountId string `json:"account_id"` AccountId string `json:"account_id"`
NickName string `json:"nickname"` NickName string `json:"nickname"`
Avatar string `json:"avatar"` Avatar string `json:"avatar"`