客户详情做延迟
This commit is contained in:
@@ -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');
|
||||||
|
|||||||
Reference in New Issue
Block a user