feat: 趋势数据库从12条扩至30条,保留7天

This commit is contained in:
Yuzhiran Dev
2026-07-12 19:00:04 +08:00
parent e48416ac8b
commit 89cf7add0e
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -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}`);