diff --git a/db/migrations/004_n8n_ingestion.sql b/db/migrations/004_n8n_ingestion.sql index 84b7920..dd5b894 100644 --- a/db/migrations/004_n8n_ingestion.sql +++ b/db/migrations/004_n8n_ingestion.sql @@ -105,7 +105,7 @@ BEGIN 'published', 'skipped' ) - ON CONFLICT (report_date) DO UPDATE SET + ON CONFLICT ON CONSTRAINT uq_daily_reports_report_date DO UPDATE SET title = EXCLUDED.title, introduction = EXCLUDED.introduction, status = 'published', @@ -123,7 +123,7 @@ BEGIN importance_score >= 85 FROM news_articles WHERE id = v_article_id - ON CONFLICT (report_id, article_id) DO UPDATE SET + ON CONFLICT ON CONSTRAINT report_articles_pkey DO UPDATE SET section = EXCLUDED.section, display_order = EXCLUDED.display_order, is_highlight = EXCLUDED.is_highlight; diff --git a/web/public/app.js b/web/public/app.js index 2495e56..7a15f75 100644 --- a/web/public/app.js +++ b/web/public/app.js @@ -2,7 +2,13 @@ const $ = (selector) => document.querySelector(selector); const escapeHtml = (value) => String(value ?? '').replace(/[&<>'"]/g, (char) => ({ '&': '&', '<': '<', '>': '>', "'": ''', '"': '"' }[char])); const categoryNames = { general: '综合', ai_agent: 'AI 与 Agent', agri_hardware: '农业硬件', agri_solutions: '方案落地', agri_services: '农业服务', policy_market: '政策市场' }; -function today() { return new Date().toISOString().slice(0, 10); } +function today() { + const now = new Date(); + const year = now.getFullYear(); + const month = String(now.getMonth() + 1).padStart(2, '0'); + const day = String(now.getDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; +} function formatDate(value) { return value ? new Intl.DateTimeFormat('zh-CN', { year: 'numeric', month: 'long', day: 'numeric', weekday: 'short' }).format(new Date(`${value}T00:00:00`)) : '—'; } function formatTime(value) { return value ? new Intl.DateTimeFormat('zh-CN', { month: 'short', day: 'numeric' }).format(new Date(value)) : '近期'; }