收口微信认证诊断日志
微信 web-view 认证失败日志改为固定阶段标签 原生壳门禁拒绝认证日志输出原生错误对象 同步宿主壳方案和共享决策记录
This commit is contained in:
@@ -177,6 +177,10 @@ function readMiniProgramEnvVersion() {
|
||||
}
|
||||
}
|
||||
|
||||
function logWebViewAuthFailure(label, _detail) {
|
||||
console.error(`[web-view] ${label}`);
|
||||
}
|
||||
|
||||
function resolveMiniProgramRuntimeConfig() {
|
||||
const miniProgramEnv =
|
||||
normalizeMiniProgramEnv(readMiniProgramEnvVersion()) ||
|
||||
@@ -252,7 +256,7 @@ function consumeAuthResult() {
|
||||
bindingStatus: String(parsed.bindingStatus || 'pending_bind_phone'),
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('[web-view] parse auth result failed', error);
|
||||
logWebViewAuthFailure('parse auth result failed', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -288,11 +292,11 @@ function wxLogin() {
|
||||
resolve(result.code);
|
||||
return;
|
||||
}
|
||||
console.error('[web-view] wx.login returned no code', result);
|
||||
logWebViewAuthFailure('wx.login returned no code', result);
|
||||
reject(new Error(WECHAT_LOGIN_UNAVAILABLE_MESSAGE));
|
||||
},
|
||||
fail(error) {
|
||||
console.error('[web-view] wx.login failed', error);
|
||||
logWebViewAuthFailure('wx.login failed', error);
|
||||
reject(new Error(WECHAT_LOGIN_UNAVAILABLE_MESSAGE));
|
||||
},
|
||||
});
|
||||
@@ -329,11 +333,11 @@ function requestMiniProgramLogin(code, displayName) {
|
||||
resolve(response.data);
|
||||
return;
|
||||
}
|
||||
console.error('[web-view] mini program login failed', response);
|
||||
logWebViewAuthFailure('mini program login failed', response);
|
||||
reject(new Error(WECHAT_LOGIN_UNAVAILABLE_MESSAGE));
|
||||
},
|
||||
fail(error) {
|
||||
console.error('[web-view] mini program login request failed', error);
|
||||
logWebViewAuthFailure('mini program login request failed', error);
|
||||
reject(new Error(WECHAT_LOGIN_UNAVAILABLE_MESSAGE));
|
||||
},
|
||||
});
|
||||
@@ -371,11 +375,11 @@ function requestMiniProgramBindPhone(authToken, wechatPhoneCode, displayName) {
|
||||
resolve(response.data);
|
||||
return;
|
||||
}
|
||||
console.error('[web-view] mini program bind phone failed', response);
|
||||
logWebViewAuthFailure('mini program bind phone failed', response);
|
||||
reject(new Error(WECHAT_BIND_PHONE_UNAVAILABLE_MESSAGE));
|
||||
},
|
||||
fail(error) {
|
||||
console.error('[web-view] mini program bind phone request failed', error);
|
||||
logWebViewAuthFailure('mini program bind phone request failed', error);
|
||||
reject(new Error(WECHAT_BIND_PHONE_UNAVAILABLE_MESSAGE));
|
||||
},
|
||||
});
|
||||
@@ -543,7 +547,7 @@ function createWechatWebViewPage() {
|
||||
webViewUrl: resolveWebViewUrl(authResult, this._lastLaunchQuery || {}),
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('[web-view] auth flow failed', error);
|
||||
logWebViewAuthFailure('auth flow failed', error);
|
||||
this.setData({
|
||||
authResult: null,
|
||||
errorMessage: WECHAT_LOGIN_UNAVAILABLE_MESSAGE,
|
||||
@@ -598,7 +602,7 @@ function createWechatWebViewPage() {
|
||||
|
||||
const detail = event.detail || {};
|
||||
if (!detail.code) {
|
||||
console.error('[web-view] bind phone auth declined', detail);
|
||||
logWebViewAuthFailure('bind phone auth declined', detail);
|
||||
this.setData({
|
||||
errorMessage: WECHAT_BIND_PHONE_AUTH_REQUIRED_MESSAGE,
|
||||
});
|
||||
@@ -649,7 +653,7 @@ function createWechatWebViewPage() {
|
||||
),
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('[web-view] bind phone failed', error);
|
||||
logWebViewAuthFailure('bind phone failed', error);
|
||||
this.setData({
|
||||
bindingPhone: false,
|
||||
errorMessage: WECHAT_BIND_PHONE_UNAVAILABLE_MESSAGE,
|
||||
|
||||
Reference in New Issue
Block a user