49 lines
2.0 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 userResponse
import (
"hospital-admin-api/api/model"
"hospital-admin-api/utils"
"strconv"
)
type User struct {
UserID string `json:"user_id"` // 主键
UserName string `json:"user_name"` // 用户名称
UserAccount string `json:"user_account"` // 账号
Mobile string `json:"mobile"` // 手机号
WxMobile string `json:"wx_mobile"` // 微信手机号
UserType int `json:"user_type"` // 用户类型1:患者 2:医师 3:药师)
UserStatus int `json:"user_status"` // 状态0:禁用 1:正常 2:删除)
RegisterMethod int `json:"register_method"` // 注册方式1:微信小程序)
Age uint `json:"age"` // 年龄
Sex int `json:"sex"` // 性别0:未知 1:男 2:女)
Avatar string `json:"avatar"` // 头像
LoginIP string `json:"login_ip"` // 登陆ip
LastLoginAt model.LocalTime `json:"last_login_at"` // 最后登陆时间
CreatedBy string `json:"created_by"` // 创建者id后台用户表id null:自己注册)
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
}
// UserResponse 用户详情
func UserResponse(user *model.User) *User {
return &User{
UserID: strconv.FormatInt(user.UserId, 10),
UserName: user.UserName,
UserAccount: user.UserAccount,
Mobile: user.Mobile,
WxMobile: user.WxMobile,
UserType: user.UserType,
UserStatus: user.UserStatus,
RegisterMethod: user.RegisterMethod,
Age: user.Age,
Sex: user.Sex,
Avatar: utils.AddOssDomain(user.Avatar),
LoginIP: user.LoginIp,
LastLoginAt: user.LastLoginAt,
CreatedBy: user.CreatedBy,
CreatedAt: user.CreatedAt,
UpdatedAt: user.UpdatedAt,
}
}