package model import ( "time" ) type User struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `gorm:"column:created_at" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at" json:"updated_at"` DeletedAt *time.Time `gorm:"index" json:"-"` Username string `gorm:"uniqueIndex;size:50;not null" json:"username"` // 邮箱注册 Email string `gorm:"uniqueIndex;size:100;not null" json:"email"` Password string `json:"-" gorm:"size:100;not null"` // SHA1 密码 Salt string `json:"-" gorm:"size:32;not null"` // 密码盐 IsAdmin bool `json:"is_admin"` // true = 管理员 Disabled bool `json:"disabled" gorm:"default:false"` // 禁用标志 SsoID string `json:"sso_id" gorm:"size:100;unique"` // OAuth2 唯一标识 Verified bool `json:"verified" gorm:"default:false"` // 是否通过邮箱验证/管理员审核 VerifyAt *time.Time `json:"verify_at,omitempty"` // 验证时间 Points int `json:"points" gorm:"default:0"` // 积分 }