Files
bl/modules/base/model/base_sys_user.go
昔念 bc4bd7eba6 refactor(login): 重构登录逻辑并优化用户信息获取
- 移除 controller 中的测试代码和不必要的注释
- 优化 login.go 中的用户信息获取逻辑,从 PlayerService 中获取玩家信息
- 删除 LoginSidInfo.go 中的冗余代码和未使用的函数
- 更新 admin 控制器中的 GetSession 方法,返回用户 ID 和 session
- 调整 base_sys_user 模型,移除冗余字段和注释
- 新增 GetPerson 方法在 base_sys_user 服务中获取用户信息
- 在 player 模型中添加 NewPlayerInfo 函数创建默认玩家信息
2025-08-22 22:40:32 +08:00

41 lines
1.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import "blazing/cool"
const TableNameBaseSysUser = "base_sys_user"
// BaseSysUser mapped from table <base_sys_user>
type BaseSysUser struct {
*cool.Model
DepartmentID uint `gorm:"column:departmentId;type:bigint;index" json:"departmentId"` // 部门ID
Name *string `gorm:"column:name;type:varchar(255)" json:"name"` // 姓名
Username string `gorm:"column:username;type:varchar(100);not null;Index" json:"username"` // 用户名
Password string `gorm:"column:password;type:varchar(255);not null" json:"password"` // 密码
PasswordV *int32 `gorm:"column:passwordV;type:int;not null;default:1" json:"passwordV"` // 密码版本, 作用是改完密码让原来的token失效
HeadImg *string `gorm:"column:headImg;type:varchar(255)" json:"headImg"` // 头像
//Phone *string `gorm:"column:phone;type:varchar(20);index" json:"phone"` // 手机
Email *string `gorm:"column:email;type:varchar(255)" json:"email"` // 邮箱
Status *int32 `gorm:"column:status;not null;default:1" json:"status"` // 状态 0:禁用 1启用
Remark *string `gorm:"column:remark;type:varchar(255)" json:"remark"` // 备注
//Role bool `gorm:"column:isNew;type:bool;not null;default:0" json:"isNew"` //
//SocketID *string `gorm:"column:socketId;type:varchar(255)" json:"socketId"` // socketId
}
// TableName BaseSysUser's table name
func (*BaseSysUser) TableName() string {
return TableNameBaseSysUser
}
// NewBaseSysUser 创建一个新的BaseSysUser
func NewBaseSysUser() *BaseSysUser {
return &BaseSysUser{
Model: cool.NewModel(),
}
}
// init 创建表
func init() {
cool.CreateTable(&BaseSysUser{})
}