随机延时移至开票初始化之后

This commit is contained in:
cheney
2026-10-20 22:19:40 +08:00
parent ef22374db7
commit fd6a6067d4
2 changed files with 39 additions and 25 deletions
+17 -12
View File
@@ -193,7 +193,11 @@ async function processHotelBill(bill, billIndex, totalBills) {
} }
const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId); const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId);
console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp)); console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp));
const waitSeconds = randomDelaySeconds();
console.log(' [延时] 随机等待 ' + waitSeconds + 's 后继续开票...');
await sleep(waitSeconds * 1000);
const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId); const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId);
console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp)); console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp));
@@ -234,7 +238,11 @@ async function processFlightBill(bill, billIndex, totalBills) {
} }
const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId); const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId);
console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp)); console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp));
const waitSeconds = randomDelaySeconds();
console.log(' [延时] 随机等待 ' + waitSeconds + 's 后继续开票...');
await sleep(waitSeconds * 1000);
const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId); const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId);
console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp)); console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp));
@@ -261,7 +269,11 @@ async function processInternationalFlightBill(bill, billIndex, totalBills) {
console.log(' --- 国际机票 [' + billIndex + '/' + totalBills + '] ' + bill.statementName + ' ---'); console.log(' --- 国际机票 [' + billIndex + '/' + totalBills + '] ' + bill.statementName + ' ---');
const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId); const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId);
console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp)); console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp));
const waitSeconds = randomDelaySeconds();
console.log(' [延时] 随机等待 ' + waitSeconds + 's 后继续开票...');
await sleep(waitSeconds * 1000);
const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId); const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId);
console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp)); console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp));
@@ -297,15 +309,8 @@ async function main() {
return; return;
} }
for (let i = 0; i < teamIds.length; i++) { for (let i = 0; i < teamIds.length; i++) {
const teamId = teamIds[i]; const teamId = teamIds[i];
if (i > 0) {
const waitSeconds = randomDelaySeconds();
console.log(' [延时] 随机等待 ' + waitSeconds + 's 后处理下一个 TEAM...\n');
await sleep(waitSeconds * 1000);
}
console.log('[' + (i + 1) + '/' + teamIds.length + '] 处理 ' + teamId + ' ...'); console.log('[' + (i + 1) + '/' + teamIds.length + '] 处理 ' + teamId + ' ...');
try { try {
+22 -13
View File
@@ -204,7 +204,11 @@ async function processTrainBill(bill, billIndex, totalBills) {
console.log(' --- 火车票 [' + billIndex + '/' + totalBills + '] ' + bill.statementName + ' ---'); console.log(' --- 火车票 [' + billIndex + '/' + totalBills + '] ' + bill.statementName + ' ---');
const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId); const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId);
console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp)); console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp));
const waitSeconds = randomDelaySeconds();
console.log(' [延时] 随机等待 ' + waitSeconds + 's 后继续开票...');
await sleep(waitSeconds * 1000);
const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId); const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId);
console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp)); console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp));
@@ -238,7 +242,11 @@ async function processHotelBill(bill, billIndex, totalBills) {
} }
const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId); const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId);
console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp)); console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp));
const waitSeconds = randomDelaySeconds();
console.log(' [延时] 随机等待 ' + waitSeconds + 's 后继续开票...');
await sleep(waitSeconds * 1000);
const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId); const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId);
console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp)); console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp));
@@ -279,7 +287,11 @@ async function processFlightBill(bill, billIndex, totalBills) {
} }
const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId); const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId);
console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp)); console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp));
const waitSeconds = randomDelaySeconds();
console.log(' [延时] 随机等待 ' + waitSeconds + 's 后继续开票...');
await sleep(waitSeconds * 1000);
const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId); const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId);
console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp)); console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp));
@@ -306,7 +318,11 @@ async function processInternationalFlightBill(bill, billIndex, totalBills) {
console.log(' --- 国际机票 [' + billIndex + '/' + totalBills + '] ' + bill.statementName + ' ---'); console.log(' --- 国际机票 [' + billIndex + '/' + totalBills + '] ' + bill.statementName + ' ---');
const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId); const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId);
console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp)); console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp));
const waitSeconds = randomDelaySeconds();
console.log(' [延时] 随机等待 ' + waitSeconds + 's 后继续开票...');
await sleep(waitSeconds * 1000);
const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId); const confirmResp = await confirmInvoiceOrder(settlementSeq, receiveBillId);
console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp)); console.log(' -> confirmInvoiceOrder:', JSON.stringify(confirmResp));
@@ -342,15 +358,8 @@ async function main() {
return; return;
} }
for (let i = 0; i < teamIds.length; i++) { for (let i = 0; i < teamIds.length; i++) {
const teamId = teamIds[i]; const teamId = teamIds[i];
if (i > 0) {
const waitSeconds = randomDelaySeconds();
console.log(' [延时] 随机等待 ' + waitSeconds + 's 后处理下一个 TEAM...\n');
await sleep(waitSeconds * 1000);
}
console.log('[' + (i + 1) + '/' + teamIds.length + '] 处理 ' + teamId + ' ...'); console.log('[' + (i + 1) + '/' + teamIds.length + '] 处理 ' + teamId + ' ...');
try { try {