refactor(login): 重构登录逻辑并优化用户信息获取

- 移除 controller 中的测试代码和不必要的注释
- 优化 login.go 中的用户信息获取逻辑,从 PlayerService 中获取玩家信息
- 删除 LoginSidInfo.go 中的冗余代码和未使用的函数
- 更新 admin 控制器中的 GetSession 方法,返回用户 ID 和 session
- 调整 base_sys_user 模型,移除冗余字段和注释
- 新增 GetPerson 方法在 base_sys_user 服务中获取用户信息
- 在 player 模型中添加 NewPlayerInfo 函数创建默认玩家信息
This commit is contained in:
2025-08-22 22:40:32 +08:00
parent 49e25d42b9
commit bc4bd7eba6
11 changed files with 226 additions and 79 deletions

View File

@@ -38,6 +38,12 @@ func (s *BaseSysUserService) GetSession(email string, password string) (res *mod
return
}
func (s *BaseSysUserService) GetPerson(userId uint) (res *model.BaseSysUser) {
m := cool.DBM(s.Model)
m.Where("id", userId).FieldsEx("password").Scan(&res)
return
}
func (s *BaseSysUserService) ModifyBefore(ctx context.Context, method string, param g.MapStrAny) (err error) {
if method == "Delete" {
// 禁止删除超级管理员