fix(source): mktnews

This commit is contained in:
ourongxing
2025-10-27 16:14:01 +00:00
parent a0941eff63
commit 3b845ce6b5
+8 -4
View File
@@ -41,17 +41,21 @@ const flash = defineSource(async () => {
const typeMap = { policy: "Policy", AI: "AI", financial: "Financial" } as const
const allReports = categories.flatMap((category) => {
const flash_list = res.data.find(item => item.name === category)?.child[0]?.flash_list || []
return flash_list.map(item => ({ ...item, type: typeMap[category] }))
const categoryData = res.data.find(item => item.name === category)
if (!categoryData?.child) return []
return categoryData.child.flatMap(subCategory =>
(subCategory.flash_list || []).map(item => ({ ...item, type: typeMap[category] })),
)
})
return allReports
.sort((a, b) => b.time.localeCompare(a.time))
.map(item => ({
id: item.id,
title: item.data.title || item.data.content,
title: item.data.title || item.data.content.match(/^【([^】]*)】(.*)$/)?.[1] || item.data.content,
pubDate: item.time,
extra: { info: item.type },
extra: { info: item.type, hover: item.data.content },
url: `https://mktnews.net/flashDetail.html?id=${item.id}`,
}))
})