File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,17 +41,21 @@ const flash = defineSource(async () => {
4141 const typeMap = { policy : "Policy" , AI : "AI" , financial : "Financial" } as const
4242
4343 const allReports = categories . flatMap ( ( category ) => {
44- const flash_list = res . data . find ( item => item . name === category ) ?. child [ 0 ] ?. flash_list || [ ]
45- return flash_list . map ( item => ( { ...item , type : typeMap [ category ] } ) )
44+ const categoryData = res . data . find ( item => item . name === category )
45+ if ( ! categoryData ?. child ) return [ ]
46+
47+ return categoryData . child . flatMap ( subCategory =>
48+ ( subCategory . flash_list || [ ] ) . map ( item => ( { ...item , type : typeMap [ category ] } ) ) ,
49+ )
4650 } )
4751
4852 return allReports
4953 . sort ( ( a , b ) => b . time . localeCompare ( a . time ) )
5054 . map ( item => ( {
5155 id : item . id ,
52- title : item . data . title || item . data . content ,
56+ title : item . data . title || item . data . content . match ( / ^ 【 ( [ ^ 】 ] * ) 】 ( . * ) $ / ) ?. [ 1 ] || item . data . content ,
5357 pubDate : item . time ,
54- extra : { info : item . type } ,
58+ extra : { info : item . type , hover : item . data . content } ,
5559 url : `https://mktnews.net/flashDetail.html?id=${ item . id } ` ,
5660 } ) )
5761} )
You can’t perform that action at this time.
0 commit comments