feat(user): 添加QQ绑定功能并重构用户登录逻辑 - 在BaseSysUser模型中添加QQ字段,移除密码字段(暂时注释) - 移除base.bbs.go中的GetUserInfo函数,将其迁移至base_sys_user.go - 将登录服务中的外部API调用逻辑整合到BaseSysUserService - 新增BindQQ方法实现QQ号绑定功能,包含重复绑定检查 - 更新GetUserInfo方法,完善用户信息获取和同步逻辑 - 优化导入包,移除未使用的依赖项 ```
45 lines
1.6 KiB
Go
45 lines
1.6 KiB
Go
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
|
||
|
||
Username string `gorm:"column:username;type:varchar(100);not null;Index" json:"username"` // 用户名
|
||
//Password string `gorm:"column:password;type:varchar(255);" 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"` // 头像
|
||
QQ int64 `gorm:"column:qq;type:bigint" json:"qq"`
|
||
|
||
Status *int32 `gorm:"column:status;not null;default:1" json:"status"` // 状态 0:禁用 1:启用
|
||
GoldBean int64 `gorm:"column:goldbean;type:bigint;default:0" json:"goldbean"`
|
||
FreeGold int64 `gorm:"column:free_gold;type:bigint;default:0" json:"free_gold"` //集市金豆
|
||
Remark *string `gorm:"column:remark;type:varchar(255)" json:"remark"` // 备注
|
||
|
||
Maxts uint32 `gorm:"column:max_ts;type:int;not null;default:0" json:"max_ts"` //最后生成的时间记录表
|
||
}
|
||
|
||
// 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{})
|
||
}
|