This commit is contained in:
eric
2026-03-31 13:15:38 -05:00
parent 4497604242
commit 33dc13f0f4
2 changed files with 23 additions and 2 deletions

View File

@@ -639,7 +639,7 @@ export default function HomeClient() {
if (nick) setWechatNick(nick);
if (avatar) setWechatAvatar(avatar);
void syncWechatProfile();
}, [syncWechatProfile]);
}, [syncWechatProfile, paidType, userEmail]);
useEffect(() => {
const urlParams = new URLSearchParams(window.location.search);
@@ -735,6 +735,27 @@ export default function HomeClient() {
}
}
// 无匿名 userId 时,若存在真实 wechat userid也要尝试直接按该 ID 查 VIP
// 场景:该 userid 本身就是支付链路 user_id或者已在后端可关联到 VIP
if (!anonymousCandidate && wechatUserId) {
const recoveredByWechatUserId = await checkPaymentFromPB(wechatUserId);
if (recoveredByWechatUserId) {
setStorage("userId", wechatUserId);
const name =
getStorage("wechatNick") ||
getStorage("userEmail") ||
getStorage("userName") ||
wechatUserId;
setUserName(name);
setUserEmail(
(getStorage("userEmail") || "").includes("@")
? getStorage("userEmail")
: null
);
return;
}
}
await getOrCreateUserId();
const afterLocalType = getStorage("paidType");