From 072696321e4b4393308a4c9a4fa1b4b253701119 Mon Sep 17 00:00:00 2001 From: Sisyphus Date: Thu, 16 Jul 2026 16:54:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(cron):=20=E7=BB=9F=E4=B8=80=E4=B8=BA=206=20?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=A0=BC=E5=BC=8F=E5=85=BC=E5=AE=B9=20cron@4?= =?UTF-8?q?.4.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【事故修复】 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) --- apps/api/prisma/seed.ts | 4 ++-- apps/web/src/components/RuleCenterPage.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/api/prisma/seed.ts b/apps/api/prisma/seed.ts index 684b8a9..8d77010 100644 --- a/apps/api/prisma/seed.ts +++ b/apps/api/prisma/seed.ts @@ -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: '["电缆","防火门","钢材","阀门"]' }, ], }) diff --git a/apps/web/src/components/RuleCenterPage.tsx b/apps/web/src/components/RuleCenterPage.tsx index 21e3f66..29b62fc 100644 --- a/apps/web/src/components/RuleCenterPage.tsx +++ b/apps/web/src/components/RuleCenterPage.tsx @@ -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: '' }, ]