From 18941236af4b3547bc61a841fd73a7330d0c16e1 Mon Sep 17 00:00:00 2001 From: cheney Date: Wed, 21 Oct 2026 20:10:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E9=9A=8F=E6=9C=BA=E5=BB=B6?= =?UTF-8?q?=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kaipiao-no-train.js | 29 ++++------------------------- kaipiao.js | 35 +++++------------------------------ 2 files changed, 9 insertions(+), 55 deletions(-) diff --git a/kaipiao-no-train.js b/kaipiao-no-train.js index a80a9b7..5de951b 100644 --- a/kaipiao-no-train.js +++ b/kaipiao-no-train.js @@ -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') { diff --git a/kaipiao.js b/kaipiao.js index 0e6d724..db69319 100644 --- a/kaipiao.js +++ b/kaipiao.js @@ -204,11 +204,7 @@ async function processTrainBill(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)); @@ -242,11 +238,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)); @@ -287,11 +279,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)); @@ -318,11 +306,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)); @@ -341,16 +325,7 @@ async function processInternationalFlightBill(bill, billIndex, totalBills) { console.log(''); } -// ========== 15. 随机延时 ========== -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') {