feat: 处理mock数据

This commit is contained in:
zdl
2025-11-07 19:57:33 +08:00
parent bd9fdefdea
commit 033f29e90c

View File

@@ -1080,14 +1080,65 @@ export const eventHandlers = [
date.setDate(date.getDate() - daysAgo);
const importance = importanceLevels[Math.floor(Math.random() * importanceLevels.length)];
const title = eventTitles[i % eventTitles.length];
// 带引用来源的研报数据
const researchReports = [
{
author: '中信证券',
report_title: `${title}深度研究报告`,
declare_date: new Date(date.getTime() - Math.floor(Math.random() * 10) * 24 * 60 * 60 * 1000).toISOString()
},
{
author: '国泰君安',
report_title: `行业专题:${title}影响分析`,
declare_date: new Date(date.getTime() - Math.floor(Math.random() * 15) * 24 * 60 * 60 * 1000).toISOString()
},
{
author: '华泰证券',
report_title: `${title}投资机会深度解析`,
declare_date: new Date(date.getTime() - Math.floor(Math.random() * 20) * 24 * 60 * 60 * 1000).toISOString()
}
];
// 生成带引用标记的contentdata结构
const contentWithCitations = {
data: [
{
query_part: `${title}的详细描述。该事件对相关产业链产生重要影响【1】市场关注度高相关概念股表现活跃。`,
sentences: `根据券商研报分析,${title}将推动相关产业链快速发展【2】。预计未来${Math.floor(Math.random() * 2 + 1)}年内,相关企业营收增速有望达到${Math.floor(Math.random() * 30 + 20)}%以上【3】。该事件的影响范围广泛涉及多个细分领域投资机会显著。`,
match_score: importance >= 4 ? '好' : (importance >= 2 ? '中' : '一般'),
author: researchReports[0].author,
declare_date: researchReports[0].declare_date,
report_title: researchReports[0].report_title
},
{
query_part: `市场分析师认为该事件将带动产业链上下游企业协同发展【2】形成良性循环。`,
sentences: `从产业趋势来看,相关板块估值仍处于合理区间,具备较高的安全边际。机构投资者持续加仓相关标的,显示出对长期发展前景的看好。`,
match_score: importance >= 3 ? '好' : '中',
author: researchReports[1].author,
declare_date: researchReports[1].declare_date,
report_title: researchReports[1].report_title
},
{
query_part: `根据行业数据显示,受此事件影响,相关企业订单量同比增长${Math.floor(Math.random() * 40 + 30)}%【3】。`,
sentences: `行业景气度持续提升,龙头企业凭借技术优势和规模效应,市场份额有望进一步扩大。建议关注产业链核心环节的投资机会。`,
match_score: '好',
author: researchReports[2].author,
declare_date: researchReports[2].declare_date,
report_title: researchReports[2].report_title
}
]
};
events.push({
id: `hist_event_${i + 1}`,
title: eventTitles[i % eventTitles.length],
description: `${eventTitles[i % eventTitles.length]}的详细描述。该事件对相关产业链产生重要影响,市场关注度高,相关概念股表现活跃。`,
title: title,
content: contentWithCitations, // 升级版本带引用来源的data结构
description: `${title}的详细描述。该事件对相关产业链产生重要影响,市场关注度高,相关概念股表现活跃。`, // 降级兼容
date: date.toISOString().split('T')[0],
importance: importance,
similarity: parseFloat((Math.random() * 0.3 + 0.7).toFixed(2)), // 0.7-1.0
similarity: Math.floor(Math.random() * 10) + 1, // 1-10
impact_sectors: [
['半导体', '芯片设计', 'EDA'],
['新能源汽车', '锂电池', '充电桩'],