Files
solosw 99b11b04e4 1.0
2026-01-05 14:11:34 +08:00

35 lines
2.1 KiB
Go

package models
import (
"time"
)
// User 用户表
type User struct {
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
Phone string `gorm:"type:varchar(20);not null;uniqueIndex" json:"phone" binding:"required"`
SystemRole uint8 `gorm:"type:tinyint;not null;default:2;comment:系统角色:0管理员,1代理商,2普通用户" json:"system_role"`
CustomerName string `gorm:"type:varchar(50)" json:"customer_name"`
RealName string `gorm:"type:varchar(50)" json:"real_name"`
CurrentPoints int `gorm:"type:int;not null;default:0;comment:当前积分" json:"current_points"`
Avatar string `gorm:"type:varchar(255)" json:"avatar"`
CompanyName string `gorm:"type:varchar(100)" json:"company_name"`
PersonalIntro string `gorm:"type:text" json:"personal_intro"`
IdentityCode string `gorm:"type:varchar(50);uniqueIndex" json:"identity_code"`
ReferrerIdentityCode string `gorm:"type:varchar(50)" json:"referrer_identity_code"`
BusinessLicenseImage string `gorm:"type:varchar(255)" json:"business_license_image"`
IdCardFrontImage string `gorm:"type:varchar(255)" json:"id_card_front_image"`
IdCardBackImage string `gorm:"type:varchar(255)" json:"id_card_back_image"`
MainPaymentQrImage *string `gorm:"type:varchar(255)" json:"main_payment_qr_image"`
SubPaymentQrImage *string `gorm:"type:varchar(255)" json:"sub_payment_qr_image"`
Password string `gorm:"type:varchar(255)" json:"password"`
Status uint8 `gorm:"type:tinyint;not null;default:1;comment:状态:0禁用,1启用" json:"status"`
ExpiryDate *time.Time `gorm:"type:timestamp;null;comment:过期时间,null表示永不过期" json:"expiry_date"`
CreatedAt time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"created_at"`
UpdatedAt time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP" json:"updated_at"`
}
func (User) TableName() string {
return "users"
}