From 33dc13f0f4053b5960bca53024de4177b59089da Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 31 Mar 2026 13:15:38 -0500 Subject: [PATCH] 's' --- app/HomeClient.tsx | 23 ++++++++++++++++++++++- app/vip/components/VipHeader.tsx | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/HomeClient.tsx b/app/HomeClient.tsx index cbde202..41fb02e 100644 --- a/app/HomeClient.tsx +++ b/app/HomeClient.tsx @@ -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"); diff --git a/app/vip/components/VipHeader.tsx b/app/vip/components/VipHeader.tsx index 4922a2a..be20f3d 100644 --- a/app/vip/components/VipHeader.tsx +++ b/app/vip/components/VipHeader.tsx @@ -87,7 +87,7 @@ export function VipHeader({ {displayName} - {onLogout && ( + {isLoggedIn && onLogout && (