客户详情做延迟

This commit is contained in:
ray
2026-05-06 14:52:53 +08:00
parent 9dd9d54163
commit ac4c7d9c3f

View File

@@ -317,6 +317,10 @@ function subtractDays(dateValue, days) {
return next; return next;
} }
function randomIntBetween(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function parseDbDateTime(value) { function parseDbDateTime(value) {
const normalized = String(value || '').trim(); const normalized = String(value || '').trim();
if (!normalized) { if (!normalized) {
@@ -655,6 +659,9 @@ async function syncCustomerDetails(page) {
await runtimeCheckpoint(`客户详情 ${index + 1}/${allAccountIds.length}`); await runtimeCheckpoint(`客户详情 ${index + 1}/${allAccountIds.length}`);
const accountId = allAccountIds[index]; const accountId = allAccountIds[index];
console.log(`[客户详情] ${index + 1}/${allAccountIds.length} accountId=${accountId}`); console.log(`[客户详情] ${index + 1}/${allAccountIds.length} accountId=${accountId}`);
const pauseMs = randomIntBetween(1000, 3000);
console.log(`[客户详情] 随机等待 ${pauseMs}ms 后继续`);
await sleep(pauseMs);
// 先跳 about:blank 再跳详情URL强制 SPA 完整重新加载) // 先跳 about:blank 再跳详情URL强制 SPA 完整重新加载)
await page.goto('about:blank'); await page.goto('about:blank');