32 lines
1.5 KiB
Go
32 lines
1.5 KiB
Go
package app
|
|
|
|
import (
|
|
"git.echol.cn/loser/st/server/global"
|
|
"gorm.io/datatypes"
|
|
"time"
|
|
)
|
|
|
|
// AppUser 前台用户模型(与 sys_users 独立)
|
|
type AppUser struct {
|
|
global.GVA_MODEL
|
|
UUID string `json:"uuid" gorm:"type:uuid;uniqueIndex;comment:用户UUID"`
|
|
Username string `json:"username" gorm:"uniqueIndex;comment:用户登录名"`
|
|
Password string `json:"-" gorm:"comment:用户登录密码"`
|
|
NickName string `json:"nickName" gorm:"comment:用户昵称"`
|
|
Email string `json:"email" gorm:"index;comment:用户邮箱"`
|
|
Phone string `json:"phone" gorm:"comment:用户手机号"`
|
|
Avatar string `json:"avatar" gorm:"type:varchar(1024);comment:用户头像"`
|
|
Status string `json:"status" gorm:"type:varchar(50);default:active;comment:账户状态"`
|
|
Enable bool `json:"enable" gorm:"default:true;comment:用户是否启用"`
|
|
LastLoginAt *time.Time `json:"lastLoginAt" gorm:"comment:最后登录时间"`
|
|
LastLoginIP string `json:"lastLoginIp" gorm:"type:varchar(100);comment:最后登录IP"`
|
|
AISettings datatypes.JSON `json:"aiSettings" gorm:"type:jsonb;comment:AI配置"`
|
|
Preferences datatypes.JSON `json:"preferences" gorm:"type:jsonb;comment:用户偏好"`
|
|
ChatCount int `json:"chatCount" gorm:"default:0;comment:对话数量"`
|
|
MessageCount int `json:"messageCount" gorm:"default:0;comment:消息数量"`
|
|
}
|
|
|
|
func (AppUser) TableName() string {
|
|
return "app_users"
|
|
}
|