移除随机延时

This commit is contained in:
cheney
2026-10-21 20:10:19 +08:00
parent 3b79054995
commit 18941236af
2 changed files with 9 additions and 55 deletions
+4 -25
View File
@@ -193,11 +193,7 @@ async function processHotelBill(bill, billIndex, totalBills) {
}
const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId);
console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp));
const waitSeconds = randomDelaySeconds();
console.log(' [延时] 随机等待 ' + waitSeconds + 's 后继续开票...');
await sleep(waitSeconds * 1000);
console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp));
const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId);
console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp));
@@ -238,11 +234,7 @@ async function processFlightBill(bill, billIndex, totalBills) {
}
const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId);
console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp));
const waitSeconds = randomDelaySeconds();
console.log(' [延时] 随机等待 ' + waitSeconds + 's 后继续开票...');
await sleep(waitSeconds * 1000);
console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp));
const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId);
console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp));
@@ -269,11 +261,7 @@ async function processInternationalFlightBill(bill, billIndex, totalBills) {
console.log(' --- 国际机票 [' + billIndex + '/' + totalBills + '] ' + bill.statementName + ' ---');
const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId);
console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp));
const waitSeconds = randomDelaySeconds();
console.log(' [延时] 随机等待 ' + waitSeconds + 's 后继续开票...');
await sleep(waitSeconds * 1000);
console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp));
const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId);
console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp));
@@ -292,16 +280,7 @@ async function processInternationalFlightBill(bill, billIndex, totalBills) {
console.log('');
}
// ========== 13. 随机延时 ==========
function sleep(ms) {
return new Promise(function (resolve) { setTimeout(resolve, ms); });
}
function randomDelaySeconds() {
return Math.floor(15 + Math.random() * 31);
}
// ========== 接口错误检查 ==========
// ========== 接口错误检查 ==========
function ensureOk(resp, what) {
if (resp && resp.code && resp.code !== 'Z000') {
if (resp.code === 'E003') {