fix: 修复爬虫问题

This commit is contained in:
Daniel
2026-03-02 17:20:31 +08:00
parent 33e4786cd0
commit 0027074b8b
21 changed files with 523 additions and 16 deletions

View File

@@ -19,6 +19,7 @@ router.get('/db/dashboard', (req, res) => {
'retaliation_current',
'retaliation_history',
'situation_update',
'news_content',
'gdelt_events',
'conflict_stats',
]
@@ -27,6 +28,7 @@ router.get('/db/dashboard', (req, res) => {
feedback: 'created_at DESC',
situation: 'updated_at DESC',
situation_update: 'timestamp DESC',
news_content: 'published_at DESC',
gdelt_events: 'event_time DESC',
wall_street_trend: 'time DESC',
retaliation_history: 'time DESC',
@@ -55,6 +57,17 @@ router.get('/db/dashboard', (req, res) => {
}
})
// 资讯内容(独立表,供后续消费)
router.get('/news', (req, res) => {
try {
const limit = Math.min(parseInt(req.query.limit, 10) || 50, 200)
const rows = db.prepare('SELECT id, title, summary, url, source, published_at, category, severity, created_at FROM news_content ORDER BY published_at DESC LIMIT ?').all(limit)
res.json({ items: rows })
} catch (err) {
res.status(500).json({ error: err.message })
}
})
router.get('/situation', (req, res) => {
try {
res.json(getSituation())