2026-07-27 00:18:42 +08:00
|
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
|
|
import "git.apinb.com/bsm-sdk/core/database"
|
|
|
|
|
|
|
2026-07-28 13:35:59 +08:00
|
|
|
|
// PlatformAccount 对应 platform_account,表示平台总后台登录账号。
|
|
|
|
|
|
type PlatformAccount struct {
|
2026-07-27 12:02:08 +08:00
|
|
|
|
Entity // 公共实体字段
|
2026-07-29 18:38:01 +08:00
|
|
|
|
Username string `gorm:"column:username;type:varchar(64);uniqueIndex;not null" json:"username"` // 登录用户名
|
|
|
|
|
|
DisplayName string `gorm:"column:display_name;type:varchar(64);not null;default:''" json:"display_name"` // 用户展示名称
|
|
|
|
|
|
Avatar string `gorm:"column:avatar;type:varchar(512);not null;default:''" json:"avatar"` // 头像资源地址
|
|
|
|
|
|
PasswordHash string `gorm:"column:password_hash;type:varchar(255);not null;default:''" json:"-"` // 密码哈希值
|
|
|
|
|
|
PlatformRoleCode string `gorm:"column:platform_role_code;type:varchar(64);not null;index" json:"platform_role_code"` // 平台角色编码
|
|
|
|
|
|
Phone string `gorm:"column:phone;type:varchar(32);not null;default:'';uniqueIndex:idx_platform_account_phone_nonempty,where:phone <> ''" json:"phone"` // 手机号,非空值唯一
|
2026-07-27 00:18:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-07-28 13:35:59 +08:00
|
|
|
|
func init() { database.AppendMigrate(&PlatformAccount{}) }
|
2026-07-27 00:18:42 +08:00
|
|
|
|
|
|
|
|
|
|
// TableName 返回与模型、文件名一致的单数数据表名。
|
2026-07-28 13:35:59 +08:00
|
|
|
|
func (table *PlatformAccount) TableName() string { return "platform_account" }
|