package model import "time" // User 用户表 type User struct { ID int64 `gorm:"primaryKey;column:id;type:BIGINT;not null" json:"id"` Name string `gorm:"column:name;type:VARCHAR(32);not null" json:"name"` Phone string `gorm:"column:phone;type:VARCHAR(32);not null;uniqueIndex:idx_phone" json:"phone"` Email string `gorm:"column:email;type:VARCHAR(64)" json:"email"` Password string `gorm:"column:password;type:VARCHAR(64);not null" json:"-"` Role string `gorm:"column:role;type:VARCHAR(16);default:user" json:"role"` TrafficBalance int64 `gorm:"column:traffic_balance;type:BIGINT;default:0" json:"trafficBalance"` Status int8 `gorm:"column:status;type:TINYINT;default:1" json:"status"` LastLogin *time.Time `gorm:"column:last_login" json:"lastLogin"` CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"` UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"` } func (User) TableName() string { return "user" }