2026-07-26 18:24:13 +08:00
|
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
|
|
import "git.apinb.com/bsm-sdk/core/database"
|
|
|
|
|
|
|
|
|
|
|
|
// IdnAccount 对应 idn_account,表示用户或服务人员身份账户。
|
|
|
|
|
|
type IdnAccount struct {
|
|
|
|
|
|
Entity
|
2026-07-26 18:47:52 +08:00
|
|
|
|
Username string `gorm:"column:username;type:varchar(64);uniqueIndex" json:"username"` // 登录用户名。
|
|
|
|
|
|
DisplayName string `gorm:"column:display_name;type:varchar(64);not null;default:''" json:"display_name"` // 用户展示名称。
|
|
|
|
|
|
PasswordHash string `gorm:"column:password_hash;type:varchar(255);not null;default:''" json:"-"` // 密码哈希值,禁止在接口中返回。
|
|
|
|
|
|
RoleCode string `gorm:"column:role_code;type:varchar(64);not null;default:'user'" json:"role_code"` // 平台角色编码。
|
|
|
|
|
|
MustChangePassword bool `gorm:"column:must_change_password;not null;default:false" json:"must_change_password"` // 是否必须修改初始密码。
|
|
|
|
|
|
MFAEnabled bool `gorm:"column:mfa_enabled;not null;default:false" json:"mfa_enabled"` // 是否启用多因素认证。
|
|
|
|
|
|
Phone string `gorm:"column:phone;type:varchar(32);uniqueIndex;not null" json:"phone"` // 手机号,用于登录和通知。
|
|
|
|
|
|
AccountType string `gorm:"column:account_type;type:varchar(32);not null" json:"account_type"` // 账号类型,例如 user、operator。
|
|
|
|
|
|
ServiceArea string `gorm:"column:service_area;type:varchar(128);not null" json:"service_area"` // 服务区域描述。
|
2026-07-26 18:24:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func init() { database.AppendMigrate(&IdnAccount{}) }
|
|
|
|
|
|
|
|
|
|
|
|
// TableName 返回与模型、文件名一致的单数数据表名。
|
|
|
|
|
|
func (table *IdnAccount) TableName() string { return "idn_account" }
|