package model import ( "time" "gorm.io/gorm" ) // Account 账号模型 type Account struct { ID uint `gorm:"primarykey" json:"id"` Username string `gorm:"uniqueIndex:idx_account_username,where:deleted_at IS NULL;not null;size:50" json:"username"` Phone string `gorm:"uniqueIndex:idx_account_phone,where:deleted_at IS NULL;not null;size:20" json:"phone"` Password string `gorm:"not null;size:255" json:"-"` // 不返回给客户端 UserType int `gorm:"not null;index" json:"user_type"` // 1=root, 2=平台, 3=代理, 4=企业 ShopID *uint `gorm:"index" json:"shop_id,omitempty"` ParentID *uint `gorm:"index" json:"parent_id,omitempty"` Status int `gorm:"not null;default:1" json:"status"` // 0=禁用, 1=启用 Creator uint `gorm:"not null" json:"creator"` Updater uint `gorm:"not null" json:"updater"` CreatedAt time.Time `gorm:"not null" json:"created_at"` UpdatedAt time.Time `gorm:"not null" json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"` } // TableName 指定表名 func (Account) TableName() string { return "tb_account" }