本地环境不验证手机号和微信登录授权

This commit is contained in:
2026-07-07 21:42:56 +08:00
parent ec748335bf
commit e32ccebc80
14 changed files with 132 additions and 24 deletions
+3
View File
@@ -6,6 +6,8 @@ export interface AppConfig {
autoApproveStore: boolean;
/** preV1 Mock 微信授权登录:点击授权按钮走 Mock 流程直接登录,不接真实微信 */
mockWechat: boolean;
/** 登录后是否走微信 SDK OAuth 授权(WX_AUTHORIZE=false 时三端跳过授权流程) */
wxAuthorize: boolean;
wechatAuthEnabled: boolean;
wechatPayEnabled: boolean;
wxAppId: string;
@@ -35,6 +37,7 @@ export function loadAppConfig(env?: Record<string, string | undefined>): AppConf
mockDeliveryAuto: e.MOCK_DELIVERY_AUTO !== 'false',
autoApproveStore: e.AUTO_APPROVE_STORE !== 'false',
mockWechat: e.MOCK_WECHAT === 'true',
wxAuthorize: e.WX_AUTHORIZE !== 'false',
wechatAuthEnabled: e.WECHAT_AUTH_ENABLED === 'true',
wechatPayEnabled: e.WECHAT_PAY_ENABLED === 'true' || e.MOCK_PAY === 'false',
wxAppId: e.WX_APP_ID ?? '',
+8
View File
@@ -28,8 +28,16 @@ export type ClientRuntimeConfig = {
mockPay: boolean;
wechatPayEnabled: boolean;
mockSms: boolean;
mockWechat?: boolean;
/** false 时三端跳过微信 SDK OAuth 授权 */
wxAuthorize?: boolean;
};
/** 是否启用登录后微信 SDK 授权(默认 true,仅 WX_AUTHORIZE=false 时关闭) */
export function isWxAuthorizeEnabled(config?: Pick<ClientRuntimeConfig, 'wxAuthorize'> | null): boolean {
return config?.wxAuthorize !== false;
}
export interface WechatLoginResult {
accessToken?: string;
refreshToken?: string;