Fix ingestion conflicts and local report date

This commit is contained in:
wuyanwanwu
2026-08-10 00:41:37 +08:00
parent 6781d44631
commit 1e4adc63c0
2 changed files with 9 additions and 3 deletions
+2 -2
View File
@@ -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;
+7 -1
View File
@@ -2,7 +2,13 @@ const $ = (selector) => document.querySelector(selector);
const escapeHtml = (value) => String(value ?? '').replace(/[&<>'"]/g, (char) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', "'": '&#39;', '"': '&quot;' }[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)) : '近期'; }