火车票版本增加try试运行参数
This commit is contained in:
+22
-2
@@ -5,6 +5,10 @@ const path = require('path');
|
||||
const EXCEL_FILE = path.join(__dirname, '新建 XLSX 工作表.xlsx');
|
||||
const SHEET_NAME = '2026';
|
||||
|
||||
// 试运行模式:运行时传入 try 参数激活(node kaipiao-train-only.js try),
|
||||
// 只查询和判断状态,不执行任何真实开票动作(init/confirm/submit);不传则执行真实开票
|
||||
const TRY = process.argv.includes('try');
|
||||
|
||||
const BASE_URL = 'https://superstar.geelytravel.com';
|
||||
const AUTH_TOKEN = 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJKV1QtRC1TRVFfVVNFUl9UTUNfMDAwMDAxODMiLCJ1c2VyX2NvZGUiOiJTRVFfVVNFUl9UTUNfMDAwMDAxODMiLCJyb2xlcyI6WyLnu5PnrpfkuJPlkZgiLCLnu5PnrpfkuJPlkZgiXSwiZXhwIjoxNzk1MDkxMTI3LCJpYXQiOjE3OTI0OTkxMjd9.wPYA-ntdWfT86LsQIYEJdVUHEksbMM9VwE96VqPdGms';
|
||||
|
||||
@@ -145,6 +149,11 @@ async function processTrainBill(bill, billIndex, totalBills) {
|
||||
|
||||
console.log(' --- 火车票 [' + billIndex + '/' + totalBills + '] ' + bill.statementName + ' ---');
|
||||
|
||||
if (TRY) {
|
||||
console.log(' [试运行] 跳过真实开票动作(init/confirm/submit)\n');
|
||||
return;
|
||||
}
|
||||
|
||||
const initResp = await initReceiveOrderPrice(settlementSeq, receiveBillId);
|
||||
console.log(' -> initReceiveOrderPrice:', JSON.stringify(initResp));
|
||||
|
||||
@@ -184,6 +193,8 @@ async function main() {
|
||||
return;
|
||||
}
|
||||
|
||||
const specialStatusTeamIds = [];
|
||||
|
||||
for (let i = 0; i < teamIds.length; i++) {
|
||||
const teamId = teamIds[i];
|
||||
console.log('[' + (i + 1) + '/' + teamIds.length + '] 处理 ' + teamId + ' ...');
|
||||
@@ -207,8 +218,12 @@ async function main() {
|
||||
|
||||
const skippedBills = allBills.filter(function (b) { return String(b.settlementStatus) === '3'; });
|
||||
skippedBills.forEach(function (b) {
|
||||
console.log(' ⚠ 跳过 settlementStatus=3 的对账单: ' + (b.statementName || b.receiveBillId || '') + '\n');
|
||||
console.log(' ⚠ 跳过 settlementStatus=3 的对账单: ' + (b.statementName || b.receiveBillId || ''));
|
||||
});
|
||||
if (skippedBills.length > 0) {
|
||||
specialStatusTeamIds.push(teamId);
|
||||
console.log(' ⚠ TEAM ' + teamId + ' 存在特殊状态(settlementStatus=3)的对账单 ' + skippedBills.length + ' 条\n');
|
||||
}
|
||||
|
||||
const bills = allBills.filter(function (b) { return String(b.settlementStatus) !== '3'; });
|
||||
console.log(' -> 实际处理 ' + bills.length + ' 条对账单\n');
|
||||
@@ -246,7 +261,12 @@ async function main() {
|
||||
console.log('');
|
||||
}
|
||||
|
||||
console.log('========== 完成 ==========');
|
||||
console.log('========== ' + (TRY ? '试运行完成(未执行真实开票)' : '完成') + ' ==========');
|
||||
if (specialStatusTeamIds.length > 0) {
|
||||
console.log('存在特殊状态(settlementStatus=3)的 TEAM: ' + specialStatusTeamIds.join(', '));
|
||||
} else {
|
||||
console.log('没有 TEAM 存在特殊状态(settlementStatus=3)的对账单');
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(err => {
|
||||
|
||||
Reference in New Issue
Block a user