Files
junhong_cmp_fiber/internal/model/account.go
2025-12-15 14:37:34 +08:00

24 lines
831 B
Go

package model
import (
"gorm.io/gorm"
)
// Account 账号模型
type Account struct {
gorm.Model
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 指定表名
func (Account) TableName() string {
return "tb_account"
}