feat: wxSignin 支持采集用户名,存量手机号用户名登录时回填昵称

- 登录带 name 时,仅当 profile.name 为空或等于手机号才回填,不覆盖真实姓名
- conf.json: 扫码登录回调与后台地址切到线上域名
This commit is contained in:
lik
2026-11-08 11:59:56 +08:00
parent 946160f3f4
commit d7d12bb19a
2 changed files with 10 additions and 2 deletions
+2 -2
View File
@@ -12,8 +12,8 @@
"web-escort-admin": {
"appid": "",
"secret": "",
"callbackUri": "http://localhost:9010/user/wechat/qr/callback",
"webOrigin": "http://localhost:5173"
"callbackUri": "https://api.huashengtec.com/user/wechat/qr/callback",
"webOrigin": "http://escort.huashengtec.com/admin"
}
},
"mongodb": {
+8
View File
@@ -1141,6 +1141,14 @@ class HandlerUser {
}
}
// 4.5 存量用户此前以手机号充当用户名:本次登录带了昵称就补全,
// 已设过真实姓名的不覆盖(新建账号在上面 create 时已写入 name)。
// 不单独 save,随步骤 8 的 issueToken 一并落库
const inputName = String(name || "").trim();
if (inputName && (!user.profile?.name || user.profile.name === user.profile.mobile)) {
user.profile.name = inputName;
}
// 5. 绑定身份:唯一索引兜底。
// 11000 可能来自 unionid(该微信已绑定其他账号)或 openid(并发绑定),
// 必须按 keyPattern / message 区分,不能一律报同一种错误。