39 lines
980 B
Go
39 lines
980 B
Go
|
package vo
|
||
|
|
||
|
import (
|
||
|
"Lee-WineList/common/constant"
|
||
|
"Lee-WineList/common/types"
|
||
|
"Lee-WineList/model/entity"
|
||
|
"Lee-WineList/utils"
|
||
|
)
|
||
|
|
||
|
// UserVO 管理员信息
|
||
|
type UserVO struct {
|
||
|
Id int `json:"id"`
|
||
|
Nickname string `json:"nickname"`
|
||
|
Username string `json:"username"`
|
||
|
Phone string `json:"phone"`
|
||
|
Status constant.UserStatus `json:"status"`
|
||
|
Sex constant.UserSex `json:"sex"`
|
||
|
Avatar string `json:"avatar"`
|
||
|
CreatedAt types.DateTime `json:"createdAt"`
|
||
|
}
|
||
|
|
||
|
// ParseOrdinary 转换为VO
|
||
|
func (auv *UserVO) ParseOrdinary(u entity.User) {
|
||
|
auv.Id = u.Id
|
||
|
auv.Phone = utils.Desensitization().Phone(u.Phone)
|
||
|
auv.Nickname = u.Nickname
|
||
|
auv.Status = u.Status
|
||
|
auv.Sex = u.Sex
|
||
|
auv.Avatar = u.Avatar
|
||
|
auv.CreatedAt = u.CreatedAt
|
||
|
}
|
||
|
|
||
|
// UserMiniVO 简要信息
|
||
|
type UserMiniVO struct {
|
||
|
Id string `json:"id"`
|
||
|
Nickname string `json:"nickname"`
|
||
|
Avatar string `json:"avatar"`
|
||
|
}
|