package model import "time" // SmsCode 短信验证码表 type SmsCode struct { ID uint `gorm:"primaryKey" json:"id"` Phone string `gorm:"size:20;index;not null" json:"phone"` Code string `gorm:"size:8;not null" json:"-"` Scene string `gorm:"size:32;not null" json:"scene"` // login / register / reset_password Used bool `gorm:"default:false" json:"used"` ExpireAt time.Time `json:"expire_at"` CreatedAt time.Time `json:"created_at"` } // PasswordReset 密码重置码表 type PasswordReset struct { ID uint `gorm:"primaryKey" json:"id"` UserID uint `gorm:"index;not null" json:"user_id"` Code string `gorm:"size:8;index;not null" json:"-"` Used bool `gorm:"default:false" json:"used"` ExpireAt time.Time `json:"expire_at"` CreatedAt time.Time `json:"created_at"` }