feat(auth): 完善扫码登录状态逻辑,支持绑定手机号和跳转
- 新增响应字段 nextAction、redirectUrl 和 successMessage,用于表示下一步操作 - 扫码登录状态为绑定手机号时,设置 nextAction 为 bind_phone,清空跳转地址 - 扫码已确认且有访问令牌时,设置跳转控制台页面,带成功提示信息 - 其他状态默认保持等待状态,确保扫码流程向前推进 - 更新扫码登录响应模型,优化前端流程控制体验
This commit is contained in:
17
.workbuddy/expert-history.json
Normal file
17
.workbuddy/expert-history.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"version": 2,
|
||||
"sessions": {
|
||||
"da2fb4dc76a94426a7dfef478f674489": [
|
||||
{
|
||||
"expertId": "SeniorDeveloper",
|
||||
"name": "Will",
|
||||
"profession": "高级开发工程师",
|
||||
"avatarUrl": "https://acc-1258344699.cos.accelerate.myqcloud.com/workbuddy/experts/avatars/02-Engineering/SeniorDeveloper/SeniorDeveloper.png",
|
||||
"promptUrl": "https://acc-1258344699.cos.accelerate.myqcloud.com/workbuddy/experts/experts/02-Engineering/SeniorDeveloper/SeniorDeveloper_zh.md",
|
||||
"usedAt": 1775495439006,
|
||||
"industryId": "all"
|
||||
}
|
||||
]
|
||||
},
|
||||
"lastUpdated": 1775497010453
|
||||
}
|
||||
12
.workbuddy/memory/2026-04-07.md
Normal file
12
.workbuddy/memory/2026-04-07.md
Normal file
@@ -0,0 +1,12 @@
|
||||
## 2026-04-07 工作记录
|
||||
|
||||
### 微信扫码登录问题修复
|
||||
1. 修复了UserSyncService中tenant_id字段名问题(从tenantId改为tenant_id)
|
||||
2. 同时发送两种格式的tenant_id字段确保兼容性
|
||||
3. 修改了WxOfficialController,在同步前从数据库重新加载用户对象
|
||||
4. 添加了详细的调试日志便于问题排查
|
||||
|
||||
### 待解决问题
|
||||
1. websopy侧app_user_cache同步失败(tenant_id为null)
|
||||
2. 扫码成功后需跳转到强制绑定手机号页面
|
||||
3. 注册成功后应跳转到控制台/console
|
||||
@@ -37,6 +37,15 @@ public class QrLoginStatusResponse {
|
||||
@Schema(description = "状态提示信息")
|
||||
private String message;
|
||||
|
||||
@Schema(description = "下一步操作:bind_phone-绑定手机号, redirect-跳转, login-直接登录")
|
||||
private String nextAction;
|
||||
|
||||
@Schema(description = "跳转URL(当nextAction为redirect时使用)")
|
||||
private String redirectUrl;
|
||||
|
||||
@Schema(description = "成功消息")
|
||||
private String successMessage;
|
||||
|
||||
public QrLoginStatusResponse(String status, String accessToken, User userInfo, Long expiresIn, Integer tenantId) {
|
||||
this.status = status;
|
||||
this.accessToken = accessToken;
|
||||
|
||||
@@ -442,6 +442,18 @@ public class QrLoginServiceImpl implements QrLoginService {
|
||||
|| QR_LOGIN_STATUS_BIND_PHONE.equals(qrLoginData.getStatus()));
|
||||
response.setMessage(qrLoginData.getMessage());
|
||||
|
||||
// 设置下一步操作逻辑
|
||||
if (QR_LOGIN_STATUS_BIND_PHONE.equals(qrLoginData.getStatus()) || Boolean.TRUE.equals(qrLoginData.getNeedBindPhone())) {
|
||||
response.setNextAction("bind_phone");
|
||||
response.setRedirectUrl(null);
|
||||
} else if (QR_LOGIN_STATUS_CONFIRMED.equals(qrLoginData.getStatus()) && StrUtil.isNotBlank(qrLoginData.getAccessToken())) {
|
||||
response.setNextAction("redirect");
|
||||
response.setRedirectUrl("/console");
|
||||
response.setSuccessMessage("登录成功,即将跳转到控制台");
|
||||
} else {
|
||||
response.setNextAction("wait");
|
||||
}
|
||||
|
||||
if (qrLoginData.getUserId() != null) {
|
||||
try {
|
||||
User user = userService.getAllByUserId(String.valueOf(qrLoginData.getUserId()));
|
||||
|
||||
Reference in New Issue
Block a user