feat: 趋势数据库从12条扩至30条,保留7天
This commit is contained in:
@@ -87,7 +87,7 @@ const displayItems = computed(() => {
|
||||
async function fetchTrends() {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await trendApi.list({ limit: 20 })
|
||||
const data = await trendApi.list({ limit: 30 })
|
||||
items.value = data.list || data.items || []
|
||||
} catch (err) {
|
||||
console.error('获取趋势失败:', err)
|
||||
|
||||
@@ -14,8 +14,8 @@ const mongoose = require('mongoose');
|
||||
const https = require('https');
|
||||
|
||||
const DB_URI = process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017/wdkj';
|
||||
const MAX_ITEMS = 12;
|
||||
const MAX_AGE_DAYS = 5;
|
||||
const MAX_ITEMS = 30;
|
||||
const MAX_AGE_DAYS = 7;
|
||||
|
||||
// 精确 AI 关键词(只匹配这些才采信,避免噪音)
|
||||
const AI_KEYWORDS = [
|
||||
@@ -167,7 +167,7 @@ async function main() {
|
||||
|
||||
// 如果不够,补保底
|
||||
if (items.length < 6) {
|
||||
const need = Math.min(FALLBACK.length, 12 - items.length);
|
||||
const need = Math.min(FALLBACK.length, MAX_ITEMS - items.length);
|
||||
const fallback = FALLBACK.slice(0, need).map(f => ({ ...f, newsDate: f.newsDate() }));
|
||||
items.push(...fallback);
|
||||
console.log(` ✓ 保底: ${need} 条`);
|
||||
|
||||
Reference in New Issue
Block a user