fix(auth): transfer WeChat id on merge; stop false phone prompts
CI / verify (pull_request) Has been cancelled

Merge used to drop wxOpenId so OAuth created a new guest without phone every time. Now migrate WeChat identity, recover legacy merged openIds, return accountMerged and force page reload, and only soft-prompt when phone is truly unbound.
This commit is contained in:
2026-07-15 21:25:34 +08:00
parent 5c55d3c385
commit d3d56150c5
7 changed files with 229 additions and 14 deletions
@@ -1,7 +1,7 @@
import Taro from '@tarojs/taro';
import { captureIosJssdkEntryUrl } from '@dukang/weixin-sdk';
import { useEffect, useRef } from 'react';
import { finishLoginNavigate, goLogin } from '../lib/auth-nav';
import { finishLoginNavigate, forceReloadAfterAccountMerge, goLogin } from '../lib/auth-nav';
import { toast } from '../lib/api';
import { saveWechatLoginResult } from '../lib/pay-wechat';
import { applyWechatShare } from '../lib/wechat-share';
@@ -70,11 +70,16 @@ export default function WechatShareBootstrap() {
if (!result) return;
if (saveWechatLoginResult(result)) {
toast('微信授权成功', 'success');
const ret = returnFromLogin || params.get('return') || undefined;
if (result.accountMerged) {
forceReloadAfterAccountMerge(ret);
return;
}
if (
returnFromLogin !== undefined ||
currentPagePathWithQuery().includes('/pages/login/')
) {
finishLoginNavigate(returnFromLogin || params.get('return') || undefined);
finishLoginNavigate(ret);
}
return;
}