JM-WechatMini/model/app/response/user.go
2023-11-02 04:34:46 +08:00

51 lines
1.6 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package response
import (
"miniapp/model/app"
"miniapp/model/common/constant"
"miniapp/model/types"
"miniapp/utils"
"strconv"
)
type UserItem struct {
Id string `json:"id"`
Phone string `json:"phone"` // 手机号
Nickname string `json:"nickname"` // 用户名
CreateAt string `json:"createAt"` // 创建时间
Avatar string `json:"avatar"` // 头像
LastLoginAt string `json:"lastLoginAt"` // 最后登录时间
Status constant.UserStatus `json:"status"` // 状态1-正常2-禁用
}
type UserVO struct {
Id string `json:"id"`
Nickname string `json:"nickname"`
Email string `json:"email"`
Username string `json:"username"`
Phone string `json:"phone"`
Status constant.UserStatus `json:"status"`
Birthday string `json:"birthday"`
Avatar string `json:"avatar"`
LastLoginAt *types.DateTime `json:"lastLoginAt"`
LastLoginIp *string `json:"lastLoginIp"`
CreatedAt types.DateTime `json:"createdAt"`
TimeNote string `json:"timeNote"`
}
func (auv *UserVO) ParseOrdinary(u app.User) {
auv.Id = strconv.Itoa(int(u.ID))
auv.Phone = utils.Desensitization().Phone(u.Phone)
auv.Nickname = u.Nickname
auv.Status = u.Status
auv.LastLoginAt = u.LastLoginAt
auv.Avatar = u.Avatar
auv.CreatedAt = types.DateTime(u.CreatedAt)
if u.IsSurgery == 1 {
auv.TimeNote = "距离下次复查时间还剩:"
} else {
auv.TimeNote = "距离手术时间还剩:"
}
}