51 lines
2.4 KiB
Go
51 lines
2.4 KiB
Go
package models
|
||
|
||
import (
|
||
"platform/web/core"
|
||
"platform/web/globals/orm"
|
||
"time"
|
||
|
||
"github.com/shopspring/decimal"
|
||
)
|
||
|
||
// User 用户表
|
||
type User struct {
|
||
core.Model
|
||
AdminID *int32 `json:"admin_id" gorm:"column:admin_id"` // 管理员ID
|
||
Phone string `json:"phone" gorm:"column:phone"` // 手机号码
|
||
Username *string `json:"username" gorm:"column:username"` // 用户名
|
||
Email *string `json:"email" gorm:"column:email"` // 邮箱
|
||
Password *string `json:"password" gorm:"column:password"` // 用户密码
|
||
Name *string `json:"name" gorm:"column:name"` // 真实姓名
|
||
Avatar *string `json:"avatar" gorm:"column:avatar"` // 头像URL
|
||
Status UserStatus `json:"status" gorm:"column:status"` // 用户状态:0-禁用,1-正常
|
||
Balance decimal.Decimal `json:"balance" gorm:"column:balance"` // 账户余额
|
||
IDType UserIDType `json:"id_type" gorm:"column:id_type"` // 认证类型:0-未认证,1-个人认证,2-企业认证
|
||
IDNo *string `json:"id_no" gorm:"column:id_no"` // 身份证号或营业执照号
|
||
IDToken *string `json:"id_token" gorm:"column:id_token"` // 身份验证标识
|
||
ContactQQ *string `json:"contact_qq" gorm:"column:contact_qq"` // QQ联系方式
|
||
ContactWechat *string `json:"contact_wechat" gorm:"column:contact_wechat"` // 微信联系方式
|
||
LastLogin *time.Time `json:"last_login" gorm:"column:last_login"` // 最后登录时间
|
||
LastLoginIP *orm.Inet `json:"last_login_ip" gorm:"column:last_login_ip"` // 最后登录地址
|
||
LastLoginUA *string `json:"last_login_ua" gorm:"column:last_login_ua"` // 最后登录代理
|
||
|
||
Admin *Admin `json:"admin,omitempty" gorm:"foreignKey:AdminID"`
|
||
}
|
||
|
||
// UserStatus 用户状态枚举
|
||
type UserStatus int
|
||
|
||
const (
|
||
UserStatusDisabled UserStatus = 0 // 禁用
|
||
UserStatusEnabled UserStatus = 1 // 正常
|
||
)
|
||
|
||
// UserIDType 用户认证类型枚举
|
||
type UserIDType int
|
||
|
||
const (
|
||
UserIDTypeUnverified UserIDType = 0 // 未认证
|
||
UserIDTypePersonal UserIDType = 1 // 个人认证
|
||
UserIDTypeEnterprise UserIDType = 2 // 企业认证
|
||
)
|