fix when return value of formatStaticCombineFilters is a empty array, program cannot run correctly

This commit is contained in:
geekgeekrun
2025-12-10 13:15:55 +08:00
parent 0aef2af350
commit d206d45242
2 changed files with 14 additions and 5 deletions
@@ -153,6 +153,14 @@ export function formatStaticCombineFilters(rawStaticCombineRecommendJobFilterCon
industryList: condition.industry ? [condition.industry] : [] industryList: condition.industry ? [condition.industry] : []
} }
}) })
result.unshift(null) if (!result.length) {
result.push({
salaryList: [],
experienceList: [],
degreeList: [],
scaleList: [],
industryList: []
})
}
return result return result
} }
@@ -535,10 +535,11 @@ async function toRecommendPage (hooks) {
}).then((res) => { }).then((res) => {
return res.json() return res.json()
}) })
await Promise.all([ page.goto(recommendJobPageUrl, { timeout: 1 * 1000 }).catch(e => { void e })
page.goto(recommendJobPageUrl, { timeout: 120 * 1000 }), await sleep(3000)
page.waitForNavigation(), await page.waitForFunction(() => {
]) return document.readyState === 'complete'
}, { timeout: 120 * 1000 })
if ( if (
page.url().startsWith('https://www.zhipin.com/web/common/403.html') || page.url().startsWith('https://www.zhipin.com/web/common/403.html') ||
page.url().startsWith('https://www.zhipin.com/web/common/error.html') page.url().startsWith('https://www.zhipin.com/web/common/error.html')