's'
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -87,7 +87,7 @@ export function VipHeader({
|
||||
<span className="block px-4 py-2 text-sm text-slate-600 dark:text-slate-400 truncate max-w-[160px]">
|
||||
<Copyable text={displayName}>{displayName}</Copyable>
|
||||
</span>
|
||||
{onLogout && (
|
||||
{isLoggedIn && onLogout && (
|
||||
<button
|
||||
onClick={handleLogout}
|
||||
className="flex w-full items-center gap-2 px-4 py-2 text-left text-sm text-slate-700 hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-slate-700"
|
||||
|
||||
Reference in New Issue
Block a user