2026-07-27 00:18:42 +08:00
|
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
|
|
import "git.apinb.com/bsm-sdk/core/database"
|
|
|
|
|
|
|
|
|
|
|
|
// UserAccount 对应 user_account,是业主客户唯一的档案和用户端登录账户。
|
|
|
|
|
|
type UserAccount struct {
|
2026-07-27 12:02:08 +08:00
|
|
|
|
Entity // 公共实体字段
|
2026-07-30 18:04:34 +08:00
|
|
|
|
Username string `gorm:"column:username;type:varchar(64);not null;uniqueIndex" json:"username"` // 登录名称
|
|
|
|
|
|
PasswordHash string `gorm:"column:password_hash;type:varchar(255);not null" json:"-"` // 密码哈希
|
|
|
|
|
|
Name string `gorm:"column:name;type:varchar(64);not null" json:"name"` // 客户姓名
|
|
|
|
|
|
Phone string `gorm:"column:phone;type:varchar(32);not null;default:'';uniqueIndex:idx_user_account_phone,where:phone <> ''" json:"phone"` // 唯一登录手机号
|
|
|
|
|
|
Avatar string `gorm:"column:avatar;type:varchar(512);not null;default:''" json:"avatar"` // 头像资源地址
|
|
|
|
|
|
RealName string `gorm:"column:real_name;type:varchar(64);not null;default:''" json:"real_name"` // 实名认证名称
|
2026-07-27 00:18:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func init() { database.AppendMigrate(&UserAccount{}) }
|
|
|
|
|
|
|
|
|
|
|
|
// TableName 返回与模型、文件名一致的单数数据表名。
|
|
|
|
|
|
func (table *UserAccount) TableName() string { return "user_account" }
|