添加callback,迁移文件

This commit is contained in:
2025-12-15 14:37:34 +08:00
parent ad946af5ee
commit 478e37903b
16 changed files with 52 additions and 367 deletions

View File

@@ -7,14 +7,14 @@ import (
// Account 账号模型
type Account struct {
gorm.Model
BaseModel
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=启用
BaseModel `gorm:"embedded"`
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=启用
}
// TableName 指定表名