This commit is contained in:
2026-01-26 01:09:20 +08:00
parent 911f03b4bd
commit 0f8986b491
5 changed files with 14 additions and 6 deletions

View File

@@ -71,12 +71,19 @@ export const listenProcess = async ({ app, mockProcess, params, timeout = 10 * 6
* 如果不提供path默认是main
*/
const {
path = 'main',
payload = {},
...rest
} = await getParams()
const msg = { ...params, ...rest, payload: { ...params?.payload, ...payload } }
/**
* 如果没有提供path和id默认取第一个路由, 而且路由path不是router的
*/
if (!msg.path && !msg.id) {
const route = app.routes.find(r => r.path !== 'router')
msg.id = route?.id
}
// 执行主要逻辑
const result = await app.run({ path, ...params, ...rest, payload: { ...params?.payload, ...payload } })
const result = await app.run(msg)
// 发送结果回主进程
const response = {
success: true,