小程序修改

This commit is contained in:
2026-07-12 19:44:36 +08:00
parent 3b4833b51a
commit e2dfb08de3
45 changed files with 2028 additions and 347 deletions
+27
View File
@@ -0,0 +1,27 @@
import { goLogin } from './auth-nav';
import { isLoggedIn } from './api';
import { fetchClientConfig, fetchUserProfile, needsWechatAuthForPay } from './pay-wechat';
/** 支付前门禁:未登录/未验手机/未绑微信时跳转登录页 */
export async function ensurePayReady(returnPath: string): Promise<boolean> {
if (!isLoggedIn()) {
goLogin(returnPath);
return false;
}
try {
const [config, profile] = await Promise.all([fetchClientConfig(), fetchUserProfile()]);
if (!profile.phoneVerified) {
goLogin(returnPath, { needPhone: '1' });
return false;
}
if (needsWechatAuthForPay(config, profile)) {
goLogin(returnPath, { needWechat: '1' });
return false;
}
return true;
} catch {
goLogin(returnPath);
return false;
}
}