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

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
+12 -7
View File
@@ -195,6 +195,10 @@ 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));
@@ -236,6 +240,10 @@ 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));
@@ -263,6 +271,10 @@ async function processInternationalFlightBill(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));
@@ -299,13 +311,6 @@ async function main() {
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 {
+16 -7
View File
@@ -206,6 +206,10 @@ async function processTrainBill(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));
@@ -240,6 +244,10 @@ 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));
@@ -281,6 +289,10 @@ 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));
@@ -308,6 +320,10 @@ async function processInternationalFlightBill(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));
@@ -344,13 +360,6 @@ async function main() {
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 {