缓存优化

This commit is contained in:
stardrophere
2026-03-12 14:17:15 +08:00
parent 3d7d53f96f
commit 37791c7976
5 changed files with 82 additions and 18 deletions
+4 -3
View File
@@ -147,9 +147,9 @@ function getPlatformColor(name: string): string {
}
function getHotLevel(score: number): { label: string; color: string; bg: string } {
if (score >= 50) return { label: '全网沸腾', color: '#ef4444', bg: 'rgba(239,68,68,0.15)' }
if (score >= 20) return { label: '高度关注', color: '#f97316', bg: 'rgba(249,115,22,0.15)' }
if (score >= 10) return { label: '上升中', color: '#3b82f6', bg: 'rgba(59,130,246,0.15)' }
if (score >= 10) return { label: '全网沸腾', color: '#ef4444', bg: 'rgba(239,68,68,0.15)' }
if (score >= 5) return { label: '高度关注', color: '#f97316', bg: 'rgba(249,115,22,0.15)' }
if (score >= 3) return { label: '上升中', color: '#3b82f6', bg: 'rgba(59,130,246,0.15)' }
return { label: '一般关注', color: '#6b7280', bg: 'rgba(107,114,128,0.15)' }
}
@@ -1171,6 +1171,7 @@ watch(() => route.query.event, (newId) => {
gap: 10px;
min-width: 0;
font-size: 14px;
font-weight:500;
}
.platform-info i {
+8 -5
View File
@@ -82,11 +82,14 @@ const revisionChains = computed<RevisionChain[]>(() => {
const chains: RevisionChain[] = []
for (const [event_id, items] of groups) {
const first = items[0]
const last = items[items.length - 1]
if (!first || !last) continue
// 组内按时间升序
items.sort((a, b) => safeParseTime(a.created_at) - safeParseTime(b.created_at))
// 拼接标题链,避免重复(相邻记录的 revised 与下一条 previous 通常相同)
const titles: string[] = [items[0].previous_headline]
const titles: string[] = [first.previous_headline]
const change_times: string[] = []
for (const item of items) {
// 若链条末尾与本条 previous 不同,说明有断层,仍然追加
@@ -100,13 +103,13 @@ const revisionChains = computed<RevisionChain[]>(() => {
chains.push({
event_id,
source_name: items[0].source_name,
source_name: first.source_name,
titles,
change_times,
first_at: items[0].created_at,
last_at: items[items.length - 1].created_at,
first_at: first.created_at,
last_at: last.created_at,
change_count: items.length,
url: items[0].url,
url: first.url,
})
}