fix(cron): 统一为 6 字段格式兼容 cron@4.4.0

【事故修复】
REPLACE(schedule, ' 1-5', '') 把 '0 8 * * 1-5' 损坏为 '0 8 * *'(4 字段,少 2 段),
cron v4.4.0 解析时报 Too few fields → API 崩溃循环重启 533 次。

【修复】
- 生产 DB: 中电建 0 0 8 * * * / 新矿 0 5 8 * * * (6 字段,含秒位)
- seed.ts: 同步修正
- CRON_PRESETS: 前端预设值也改为 6 字段格式
- 生产 API 已重启(pid 2325762, health OK)
This commit is contained in:
Sisyphus 2026-07-16 16:54:00 +08:00
parent 6964380de5
commit 072696321e
2 changed files with 5 additions and 5 deletions

View File

@ -120,8 +120,8 @@ async function main() {
await prisma.crawlerConfig.deleteMany()
await prisma.crawlerConfig.createMany({
data: [
{ name: '中国电建阳光采购网', targetUrl: 'https://bid.powerchina.cn', type: 'bid_powerchina', sourceName: '中电建', status: 'active', schedule: '0 8 * * *', totalRuns: 286, successRuns: 275, failedRuns: 11, keywords: '["电缆","防火门","配电箱","钢材"]' },
{ name: '新矿集团供应链平台', targetUrl: 'https://xkgroup.kdcloud.com', type: 'bid_xkgroup', sourceName: '新矿集团', scriptPath: 'fetch-xkgroup.py', status: 'active', schedule: '5 8 * * *', totalRuns: 142, successRuns: 138, failedRuns: 4, keywords: '["电缆","钢材","阀门","管材"]' },
{ name: '中国电建阳光采购网', targetUrl: 'https://bid.powerchina.cn', type: 'bid_powerchina', sourceName: '中电建', status: 'active', schedule: '0 0 8 * * *', totalRuns: 286, successRuns: 275, failedRuns: 11, keywords: '["电缆","防火门","配电箱","钢材"]' },
{ name: '新矿集团供应链平台', targetUrl: 'https://xkgroup.kdcloud.com', type: 'bid_xkgroup', sourceName: '新矿集团', scriptPath: 'fetch-xkgroup.py', status: 'active', schedule: '0 5 8 * * *', totalRuns: 142, successRuns: 138, failedRuns: 4, keywords: '["电缆","钢材","阀门","管材"]' },
{ name: '中核集团电子采购平台', targetUrl: 'https://www.cnncecp.com', type: 'bid_cnncecp', sourceName: '中核集团', scriptPath: 'fetch-cnncecp.py', status: 'paused', totalRuns: 0, successRuns: 0, failedRuns: 0, keywords: '["电缆","防火门","钢材","阀门"]' },
],
})

View File

@ -122,9 +122,9 @@ const TYPE_OPTIONS = [
{ value: 'bid_cnncecp', label: '中核集团招采' },
]
const CRON_PRESETS = [
{ label: '每 6 个小时', value: '0 */6 * * *' },
{ label: '每天早 8 点', value: '0 8 * * *' },
{ label: '每天晚 7 点', value: '0 19 * * *' },
{ label: '每 6 个小时', value: '0 0 */6 * * *' },
{ label: '每天早 8 点', value: '0 0 8 * * *' },
{ label: '每天晚 7 点', value: '0 0 19 * * *' },
{ label: '手动(不自动执行)', value: '' },
]