feat: wxSignin 支持采集用户名,存量手机号用户名登录时回填昵称
- 登录带 name 时,仅当 profile.name 为空或等于手机号才回填,不覆盖真实姓名 - conf.json: 扫码登录回调与后台地址切到线上域名
This commit is contained in:
@@ -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": {
|
||||
|
||||
@@ -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 区分,不能一律报同一种错误。
|
||||
|
||||
Reference in New Issue
Block a user