Compare commits

..
2 Commits
Author SHA1 Message Date
cheney 3b79054995 更新代理配置与对账单数据 2026-10-21 19:59:48 +08:00
cheney 9cf1aacd74 更新token并增加接口错误处理 2026-10-21 19:59:46 +08:00
5 changed files with 59 additions and 33 deletions
+19 -6
View File
@@ -6,7 +6,7 @@ const EXCEL_FILE = path.join(__dirname, '新建 XLSX 工作表.xlsx');
const SHEET_NAME = '2026'; const SHEET_NAME = '2026';
const BASE_URL = 'https://superstar.geelytravel.com'; const BASE_URL = 'https://superstar.geelytravel.com';
const AUTH_TOKEN = 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJKV1QtRC1TRVFfVVNFUl9UTUNfMDAwMDAxODMiLCJ1c2VyX2NvZGUiOiJTRVFfVVNFUl9UTUNfMDAwMDAxODMiLCJyb2xlcyI6WyLnu5PnrpfkuJPlkZgiLCLnu5PnrpfkuJPlkZgiXSwiZXhwIjoxNzg2NTMzNTUxLCJpYXQiOjE3ODM5NDE1NTF9.1Mcmf5IM07Scrry4FzPs6TAcfUu0Nqtjre_2iJlNd5c'; const AUTH_TOKEN = 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJKV1QtRC1TRVFfVVNFUl9UTUNfMDAwMDAxODMiLCJ1c2VyX2NvZGUiOiJTRVFfVVNFUl9UTUNfMDAwMDAxODMiLCJyb2xlcyI6WyLnu5PnrpfkuJPlkZgiLCLnu5PnrpfkuJPlkZgiXSwiZXhwIjoxNzk1MDkxMTI3LCJpYXQiOjE3OTI0OTkxMjd9.wPYA-ntdWfT86LsQIYEJdVUHEksbMM9VwE96VqPdGms';
const COMMON_HEADERS = { const COMMON_HEADERS = {
'accept': 'application/json, text/plain, */*', 'accept': 'application/json, text/plain, */*',
@@ -297,10 +297,21 @@ function sleep(ms) {
return new Promise(function (resolve) { setTimeout(resolve, ms); }); return new Promise(function (resolve) { setTimeout(resolve, ms); });
} }
function randomDelaySeconds() { function randomDelaySeconds() {
return Math.floor(15 + Math.random() * 31); return Math.floor(15 + Math.random() * 31);
} }
// ========== 接口错误检查 ==========
function ensureOk(resp, what) {
if (resp && resp.code && resp.code !== 'Z000') {
if (resp.code === 'E003') {
console.error(' ✗ token 已失效(E003: ' + (resp.msg || '') + '),请更新 AUTH_TOKEN');
process.exit(1);
}
throw new Error(what + ' 失败: [' + resp.code + '] ' + (resp.msg || resp.message || ''));
}
}
// ========== 主流程 ========== // ========== 主流程 ==========
async function main() { async function main() {
const teamIds = readTeamIds(); const teamIds = readTeamIds();
@@ -314,7 +325,8 @@ async function main() {
console.log('[' + (i + 1) + '/' + teamIds.length + '] 处理 ' + teamId + ' ...'); console.log('[' + (i + 1) + '/' + teamIds.length + '] 处理 ' + teamId + ' ...');
try { try {
const settlementResp = await querySettlementAccountIds(teamId); const settlementResp = await querySettlementAccountIds(teamId);
ensureOk(settlementResp, 'querySettlementAccountIds');
const resultList = settlementResp?.result || []; const resultList = settlementResp?.result || [];
if (resultList.length === 0) { if (resultList.length === 0) {
console.log(' ⚠ ' + teamId + ' 没有 settlement account,跳过\n'); console.log(' ⚠ ' + teamId + ' 没有 settlement account,跳过\n');
@@ -324,6 +336,7 @@ async function main() {
console.log(' -> settlementAccountId: ' + settlementAccountId); console.log(' -> settlementAccountId: ' + settlementAccountId);
const billResp = await queryBillList(settlementAccountId); const billResp = await queryBillList(settlementAccountId);
ensureOk(billResp, 'queryBillList');
const allBills = billResp?.result?.list || []; const allBills = billResp?.result?.list || [];
const total = billResp?.result?.total || 0; const total = billResp?.result?.total || 0;
console.log(' -> 共 ' + total + ' 条对账单'); console.log(' -> 共 ' + total + ' 条对账单');
+19 -6
View File
@@ -6,7 +6,7 @@ const EXCEL_FILE = path.join(__dirname, '新建 XLSX 工作表.xlsx');
const SHEET_NAME = '2026'; const SHEET_NAME = '2026';
const BASE_URL = 'https://superstar.geelytravel.com'; const BASE_URL = 'https://superstar.geelytravel.com';
const AUTH_TOKEN = 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJKV1QtRC1TRVFfVVNFUl9UTUNfMDAwMDAxODMiLCJ1c2VyX2NvZGUiOiJTRVFfVVNFUl9UTUNfMDAwMDAxODMiLCJyb2xlcyI6WyLnu5PnrpfkuJPlkZgiLCLnu5PnrpfkuJPlkZgiXSwiZXhwIjoxNzg2NTMzNTUxLCJpYXQiOjE3ODM5NDE1NTF9.1Mcmf5IM07Scrry4FzPs6TAcfUu0Nqtjre_2iJlNd5c'; const AUTH_TOKEN = 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJKV1QtRC1TRVFfVVNFUl9UTUNfMDAwMDAxODMiLCJ1c2VyX2NvZGUiOiJTRVFfVVNFUl9UTUNfMDAwMDAxODMiLCJyb2xlcyI6WyLnu5PnrpfkuJPlkZgiLCLnu5PnrpfkuJPlkZgiXSwiZXhwIjoxNzk1MDkxMTI3LCJpYXQiOjE3OTI0OTkxMjd9.wPYA-ntdWfT86LsQIYEJdVUHEksbMM9VwE96VqPdGms';
const COMMON_HEADERS = { const COMMON_HEADERS = {
'accept': 'application/json, text/plain, */*', 'accept': 'application/json, text/plain, */*',
@@ -346,10 +346,21 @@ function sleep(ms) {
return new Promise(function (resolve) { setTimeout(resolve, ms); }); return new Promise(function (resolve) { setTimeout(resolve, ms); });
} }
function randomDelaySeconds() { function randomDelaySeconds() {
return Math.floor(15 + Math.random() * 31); return Math.floor(15 + Math.random() * 31);
} }
// ========== 接口错误检查 ==========
function ensureOk(resp, what) {
if (resp && resp.code && resp.code !== 'Z000') {
if (resp.code === 'E003') {
console.error(' ✗ token 已失效(E003: ' + (resp.msg || '') + '),请更新 AUTH_TOKEN');
process.exit(1);
}
throw new Error(what + ' 失败: [' + resp.code + '] ' + (resp.msg || resp.message || ''));
}
}
// ========== 主流程 ========== // ========== 主流程 ==========
async function main() { async function main() {
const teamIds = readTeamIds(); const teamIds = readTeamIds();
@@ -363,7 +374,8 @@ async function main() {
console.log('[' + (i + 1) + '/' + teamIds.length + '] 处理 ' + teamId + ' ...'); console.log('[' + (i + 1) + '/' + teamIds.length + '] 处理 ' + teamId + ' ...');
try { try {
const settlementResp = await querySettlementAccountIds(teamId); const settlementResp = await querySettlementAccountIds(teamId);
ensureOk(settlementResp, 'querySettlementAccountIds');
const resultList = settlementResp?.result || []; const resultList = settlementResp?.result || [];
if (resultList.length === 0) { if (resultList.length === 0) {
console.log(' ⚠ ' + teamId + ' 没有 settlement account,跳过\n'); console.log(' ⚠ ' + teamId + ' 没有 settlement account,跳过\n');
@@ -373,6 +385,7 @@ async function main() {
console.log(' -> settlementAccountId: ' + settlementAccountId); console.log(' -> settlementAccountId: ' + settlementAccountId);
const billResp = await queryBillList(settlementAccountId); const billResp = await queryBillList(settlementAccountId);
ensureOk(billResp, 'queryBillList');
const allBills = billResp?.result?.list || []; const allBills = billResp?.result?.list || [];
const total = billResp?.result?.total || 0; const total = billResp?.result?.total || 0;
console.log(' -> 共 ' + total + ' 条对账单'); console.log(' -> 共 ' + total + ' 条对账单');
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"server": { "server": {
"url": "ws://bh.vps.honor3.com:18888/websocket_path", "url": "ws://baishe.vps.honor3.com:18888/websocket_path",
"password": "helloworld" "password": "helloworld"
}, },
"client_name": "cheney" "client_name": "cheney"
+20 -20
View File
@@ -1,21 +1,21 @@
{ {
"port": 18888, "port": 18888,
"password": "helloworld", "password": "helloworld",
"path": "/websocket_path", "path": "/websocket_path",
"admin": { "admin": {
"enable": true, "enable": true,
"admin_password": "helloworld" "admin_password": "helloworld"
}, },
"client_config": { "client_config": {
"fyx": [ "fyx": [
{ {
"name": "superstar", "name": "superstar",
"remote_port": 4443, "remote_port": 4443,
"local_port": 443, "local_port": 443,
"local_ip": "198.19.0.115", "local_ip": "198.19.0.22",
"speed_limit": 0.0, "speed_limit": 0.0,
"protocol": "tcp" "protocol": "tcp"
} }
] ]
} }
} }
Binary file not shown.