fix: 修复脚本依次执行问题
This commit is contained in:
@@ -51,8 +51,7 @@ export function runTaskOperationService() {
|
|||||||
['fzName', 'fg_trace.js'],
|
['fzName', 'fg_trace.js'],
|
||||||
['mtName', 'mt_trace.js'],
|
['mtName', 'mt_trace.js'],
|
||||||
['dyHotelName', 'dy_hotel_trace.js'],
|
['dyHotelName', 'dy_hotel_trace.js'],
|
||||||
['dyHotSpringName', 'dy_hot_spring_trace.js'],
|
['dyHotSpringName', 'dy_hot_spring_trace.js']
|
||||||
['xcName', 'xc_trace.js'],
|
|
||||||
]
|
]
|
||||||
const scriptEntries = pairs.filter(([prop]) => roomType?.[prop])
|
const scriptEntries = pairs.filter(([prop]) => roomType?.[prop])
|
||||||
|
|
||||||
@@ -75,9 +74,14 @@ export function runTaskOperationService() {
|
|||||||
dyHotelName: 'douyin',
|
dyHotelName: 'douyin',
|
||||||
dyHotSpringName: 'douyin',
|
dyHotSpringName: 'douyin',
|
||||||
}
|
}
|
||||||
|
const defaultTabIndexMap: Record<string, number> = {
|
||||||
|
fliggy: 0,
|
||||||
|
meituan: 1,
|
||||||
|
douyin: 2
|
||||||
|
}
|
||||||
const mappedName = channelNameMap[item.channel]
|
const mappedName = channelNameMap[item.channel]
|
||||||
const tabIndex = mappedName ? (openedTabIndexByChannelName.get(mappedName) ?? i) : i
|
const tabIndex = mappedName ? (openedTabIndexByChannelName.get(mappedName) ?? defaultTabIndexMap[mappedName] ?? i) : i
|
||||||
log.info(`Launching script for channel ${item.channel}: ${item.scriptPath}`)
|
log.info(`Launching script for channel ${item.channel}: ${item.scriptPath} (tabIndex: ${tabIndex})`)
|
||||||
const result = await executeScriptServiceInstance.executeScript(item.scriptPath, {
|
const result = await executeScriptServiceInstance.executeScript(item.scriptPath, {
|
||||||
roomType: roomType[item.channel],
|
roomType: roomType[item.channel],
|
||||||
startTime: options.startTime,
|
startTime: options.startTime,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ const isSameOrigin = (currentUrl, targetUrl) => {
|
|||||||
const current = normalizeUrl(currentUrl);
|
const current = normalizeUrl(currentUrl);
|
||||||
const target = normalizeUrl(targetUrl);
|
const target = normalizeUrl(targetUrl);
|
||||||
if (!current || !target) return false;
|
if (!current || !target) return false;
|
||||||
|
|
||||||
return current.origin === target.origin;
|
return current.origin === target.origin;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 245 KiB |
@@ -220,5 +220,6 @@ const navigateToRoomStatusManagement = async (page) => {
|
|||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
} finally {
|
} finally {
|
||||||
await safeDisconnectBrowser(browser);
|
await safeDisconnectBrowser(browser);
|
||||||
|
process.exit(process.exitCode || 0);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -220,5 +220,6 @@ const navigateToRoomStatusManagement = async (page) => {
|
|||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
} finally {
|
} finally {
|
||||||
await safeDisconnectBrowser(browser);
|
await safeDisconnectBrowser(browser);
|
||||||
|
process.exit(process.exitCode || 0);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -169,5 +169,6 @@ const toggleRoomByDateIndex = async (container, { roomType, dateIndex, operation
|
|||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
} finally {
|
} finally {
|
||||||
await safeDisconnectBrowser(browser);
|
await safeDisconnectBrowser(browser);
|
||||||
|
process.exit(process.exitCode || 0);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 74 KiB |
@@ -232,5 +232,6 @@ const toggleRoom = async (page, { roomType, mmdd, operation }) => {
|
|||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
} finally {
|
} finally {
|
||||||
await safeDisconnectBrowser(browser);
|
await safeDisconnectBrowser(browser);
|
||||||
|
process.exit(process.exitCode || 0);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -128,5 +128,6 @@ const isBlankLikePage = (url) => {
|
|||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
process.exit(process.exitCode || 0);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
import log from 'electron-log';
|
|
||||||
|
|
||||||
log.info('xc_trace.mjs placeholder: not implemented');
|
|
||||||
process.exit(0);
|
|
||||||
@@ -46,6 +46,6 @@ export async function launchLocalChrome() {
|
|||||||
// 延迟几秒等浏览器起来
|
// 延迟几秒等浏览器起来
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
resolve(0);
|
resolve(0);
|
||||||
}, 3000); // 延迟3秒
|
}, 1000); // 延迟1秒
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user