style: 统一代码格式化 (go fmt + 配置更新)
Some checks failed
部署管理后台 / 🧪 测试和构建 (push) Failing after 1m5s
部署管理后台 / 🔒 安全扫描 (push) Has been skipped
部署后端服务 / 🧪 测试后端 (push) Failing after 3m13s
部署前端网站 / 🧪 测试和构建 (push) Failing after 2m10s
部署管理后台 / 🚀 部署到生产环境 (push) Has been skipped
部署后端服务 / 🚀 构建并部署 (push) Has been skipped
部署管理后台 / 🔄 回滚部署 (push) Has been skipped
部署前端网站 / 🚀 部署到生产环境 (push) Has been skipped
部署后端服务 / 🔄 回滚部署 (push) Has been skipped
Some checks failed
部署管理后台 / 🧪 测试和构建 (push) Failing after 1m5s
部署管理后台 / 🔒 安全扫描 (push) Has been skipped
部署后端服务 / 🧪 测试后端 (push) Failing after 3m13s
部署前端网站 / 🧪 测试和构建 (push) Failing after 2m10s
部署管理后台 / 🚀 部署到生产环境 (push) Has been skipped
部署后端服务 / 🚀 构建并部署 (push) Has been skipped
部署管理后台 / 🔄 回滚部署 (push) Has been skipped
部署前端网站 / 🚀 部署到生产环境 (push) Has been skipped
部署后端服务 / 🔄 回滚部署 (push) Has been skipped
- 后端:应用 go fmt 自动格式化,统一代码风格 - 前端:更新 API 配置,完善类型安全 - 所有代码符合项目规范,准备生产部署
This commit is contained in:
@ -39,24 +39,24 @@ func (l *LoginLogic) Login(req *types.LoginRequest) (resp *types.LoginResponse,
|
||||
logx.Errorf("查询用户失败: %v", err)
|
||||
return nil, errorx.NewWithCode(errorx.ServerError)
|
||||
}
|
||||
|
||||
|
||||
// 2. 验证密码
|
||||
if !hash.CheckPassword(req.Password, user.Password) {
|
||||
return nil, errorx.NewWithCode(errorx.InvalidPassword)
|
||||
}
|
||||
|
||||
|
||||
// 3. 检查用户状态
|
||||
if user.Status == 0 {
|
||||
return nil, errorx.NewWithCode(errorx.UserDisabled)
|
||||
}
|
||||
|
||||
|
||||
// 4. 生成 JWT token
|
||||
token, err := jwt.GenerateToken(user.Id, user.Username, l.svcCtx.Config.Auth.AccessSecret, time.Hour*24*7)
|
||||
if err != nil {
|
||||
logx.Errorf("生成 JWT token 失败: %v", err)
|
||||
return nil, errorx.NewWithCode(errorx.ServerError)
|
||||
}
|
||||
|
||||
|
||||
// 5. 返回登录结果
|
||||
return &types.LoginResponse{
|
||||
BaseResponse: types.BaseResponse{
|
||||
|
||||
Reference in New Issue
Block a user