feat: 飞猪脚本调试

This commit is contained in:
duanshuwen
2026-03-10 22:24:45 +08:00
parent 8a6544ede2
commit d07c65c581
6 changed files with 45 additions and 6 deletions

View File

@@ -14,13 +14,13 @@ export function runTaskOperationService() {
try {
await launchLocalChrome(options)
const channels = ['feizhu', 'meituan', 'douyin', 'xiaocheng']
const channels = ['fz', 'mt', 'dy', 'xc']
const scriptMap: Record<string, string> = {
feizhu: 'fg_trace.mjs',
meituan: 'mt_trace.mjs',
douyin: 'dy_trace.mjs',
xiaocheng: 'xc_trace.mjs',
fz: 'fg_trace.mjs',
mt: 'mt_trace.mjs',
dy: 'dy_trace.mjs',
xc: 'xc_trace.mjs',
}
const scriptsDir = app.isPackaged

View File

@@ -0,0 +1,4 @@
import log from 'electron-log';
log.info('dy_trace.mjs placeholder: not implemented');
process.exit(0);

View File

@@ -102,6 +102,33 @@ const checkLoginStatus = async (page) => {
await page.waitForTimeout(4000 + Math.random() * 1000);
await page.getByText('房价房量日历').click();
// 获取网页接口(监听所有请求)
await page.on('request', response => {
const url = response.url()
// log.info('request response:', url)
if (url.includes('/heinventory/queryRoomTypeAndRatePlanLite')) {
// const data = await response.json()
log.info('interface response:', JSON.parse(response.postData()))
}
// log.info('URL:', request.url())
// log.info('Method:', request.method())
// log.info('PostData:', request.postData())
})
// 获取接口返回数据
await page.on('response', async (response) => {
const url = response.url()
if (url.includes('/heinventory/queryRoomTypeAndRatePlanLite')) {
const data = await response.json()
log.info('interface response:', data)
}
})
// await page.pause();
/*
* 1、我要知道日期

View File

@@ -0,0 +1,4 @@
import log from 'electron-log';
log.info('mt_trace.mjs placeholder: not implemented');
process.exit(0);

View File

@@ -0,0 +1,4 @@
import log from 'electron-log';
log.info('xc_trace.mjs placeholder: not implemented');
process.exit(0);

View File

@@ -45,4 +45,4 @@ export async function launchLocalChrome (options: any) {
// 等浏览器起来
resolve(0);
});
}
}