修改Whatshub工单的完成数量总计的计算方法

This commit is contained in:
root
2026-07-05 02:13:06 +08:00
parent 6b72cd7b67
commit f1acab12a7
33 changed files with 338 additions and 96 deletions
+16 -6
View File
@@ -227,17 +227,21 @@ function applyWhatshubPostCfDefaults(antiBot, pageUrl) {
}
try {
const parsed = new URL(pageUrl || '');
if (!parsed.hostname.includes('whatshub.cc') || !parsed.pathname.includes('/m/')) {
const isWhatshubHost = parsed.hostname.includes('whatshub.cc');
const isShortLink = parsed.pathname.includes('/m/');
const isLongLink = pageUrl.includes('work-order-sharing');
if (!isWhatshubHost || (!isShortLink && !isLongLink)) {
return antiBot;
}
console.log('[CF] Whatshub 短链自动启用 postCfReady 默认配置');
console.log('[CF] Whatshub 自动启用 postCfReady 默认配置');
return {
...antiBot,
postCfReadyUrlContains: 'work-order-sharing',
postCfReadySelector: '.el-input__inner',
postCfReadyTimeoutMs: antiBot.postCfReadyTimeoutMs || 30000,
postCfReadyApiUrl: '/api/whatshub-counter/workShare/open/statistics',
postCfReadyTimeoutMs: antiBot.postCfReadyTimeoutMs || 60000,
postCfSettleMs: antiBot.postCfSettleMs || 500,
postCfSpaWaitMs: antiBot.postCfSpaWaitMs || 8000,
postCfSpaWaitMs: antiBot.postCfSpaWaitMs || 4000,
};
} catch (_) {
return antiBot;
@@ -1187,11 +1191,17 @@ async function runCloudflareWithBusinessGuard(page, antiBot, waitForUrlSettled,
cfResult = await handleCloudflareChallengeSafe(page, antiBot, waitForUrlSettled, storedSession);
}
// 短链跨域落地(如 yyk.ink → user.a2c.chat)后,业务域可能仍有 CF
// 短链跨域落地(如 yyk.ink → user.a2c.chat、Whatshub /m/ → work-order-sharing)后,业务域可能仍有 CF
if (cfResult.success && !(await isCfTrulyComplete(page, antiBot))) {
const crossState = await detectCloudflare(page, antiBot);
if (crossState.blocked || urlIndicatesCfChallenge(page.url())) {
console.log(`[CF] 跨域落地后 CF 未完成,二次过盾 url=${page.url()}`);
const isWhatshubLongCf =
urlNeedle === 'work-order-sharing' && urlIndicatesCfChallenge(page.url());
if (isWhatshubLongCf) {
console.log(`[CF] Whatshub 长链二次过盾 url=${page.url()}`);
} else {
console.log(`[CF] 跨域落地后 CF 未完成,二次过盾 url=${page.url()}`);
}
page = await maybeEnsureProxy(page);
cfResult = await finalizeCfResult(
page,