From d7d12bb19a16c147a48a9847236332e4ee6cdef5 Mon Sep 17 00:00:00 2001 From: lik Date: Sun, 8 Nov 2026 11:59:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20wxSignin=20=E6=94=AF=E6=8C=81=E9=87=87?= =?UTF-8?q?=E9=9B=86=E7=94=A8=E6=88=B7=E5=90=8D=EF=BC=8C=E5=AD=98=E9=87=8F?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=E7=94=A8=E6=88=B7=E5=90=8D=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=97=B6=E5=9B=9E=E5=A1=AB=E6=98=B5=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 登录带 name 时,仅当 profile.name 为空或等于手机号才回填,不覆盖真实姓名 - conf.json: 扫码登录回调与后台地址切到线上域名 --- conf.json | 4 ++-- handler/users.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/conf.json b/conf.json index ae42140..f1faea2 100644 --- a/conf.json +++ b/conf.json @@ -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": { diff --git a/handler/users.js b/handler/users.js index c437229..d7108f9 100644 --- a/handler/users.js +++ b/handler/users.js @@ -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 区分,不能一律报同一种错误。