feat: 修复数据结构访问
This commit is contained in:
@@ -873,14 +873,17 @@ export function generateMockEvents(params = {}) {
|
||||
filteredEvents = filteredEvents.filter(e =>
|
||||
e.title.toLowerCase().includes(query) ||
|
||||
e.description.toLowerCase().includes(query) ||
|
||||
e.keywords.some(k => k.toLowerCase().includes(query))
|
||||
// keywords 是对象数组 { concept, score, ... },需要访问 concept 属性
|
||||
e.keywords.some(k => k.concept && k.concept.toLowerCase().includes(query))
|
||||
);
|
||||
}
|
||||
|
||||
// 行业筛选
|
||||
if (industry_code) {
|
||||
filteredEvents = filteredEvents.filter(e =>
|
||||
e.industry.includes(industry_code) || e.keywords.includes(industry_code)
|
||||
e.industry.includes(industry_code) ||
|
||||
// keywords 是对象数组 { concept, ... },需要检查 concept 属性
|
||||
e.keywords.some(k => k.concept && k.concept.includes(industry_code))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -893,9 +896,11 @@ export function generateMockEvents(params = {}) {
|
||||
return false;
|
||||
}
|
||||
// 检查事件的 related_stocks 中是否包含该股票代码
|
||||
return e.related_stocks.some(code => {
|
||||
const cleanCode = code.replace(/\.(SH|SZ)$/, '');
|
||||
return cleanCode === cleanStockCode || code === stock_code;
|
||||
// related_stocks 是对象数组 { stock_code, stock_name, ... }
|
||||
return e.related_stocks.some(stock => {
|
||||
const stockCodeStr = stock.stock_code || '';
|
||||
const cleanCode = stockCodeStr.replace(/\.(SH|SZ)$/, '');
|
||||
return cleanCode === cleanStockCode || stockCodeStr === stock_code;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user