feat: 添加合规

This commit is contained in:
zdl
2025-10-20 21:25:33 +08:00
parent d695f8ff7b
commit 6c96299b8f
42 changed files with 7118 additions and 289 deletions

View File

@@ -326,6 +326,177 @@ export const mockInvestmentPlans = [
// ==================== 投资日历事件数据 ====================
// ==================== 未来事件数据(用于投资日历) ====================
export const mockFutureEvents = [
{
id: 501,
data_id: 501,
title: '美联储FOMC会议',
calendar_time: '2025-10-20T14:00:00Z',
type: 'event',
star: 5,
former: {
data: [
{
author: '美联储官网',
sentences: '本次会议将重点讨论通胀控制和利率调整策略,美联储将评估当前经济形势,包括就业市场、物价水平和金融稳定性等关键指标,以决定是否调整联邦基金利率目标区间',
query_part: '本次会议将重点讨论通胀控制和利率调整策略',
report_title: 'FOMC会议议程公告',
declare_date: '2025-10-15T00:00:00',
match_score: '好'
},
{
author: '彭博社',
sentences: '市场普遍预期美联储将维持当前利率水平根据对50位经济学家的调查超过80%的受访者认为美联储将在本次会议上保持利率不变,等待更多经济数据以评估政策效果',
query_part: '市场普遍预期美联储将维持当前利率水平',
report_title: '美联储利率决议前瞻:经济学家调查报告',
declare_date: '2025-10-18T00:00:00',
match_score: '好'
},
{
author: '路透社',
sentences: '鲍威尔的讲话将释放未来货币政策方向的重要信号,市场将密切关注其对经济前景的评估,特别是关于通胀回落速度、就业市场韧性以及未来降息时点的表述',
query_part: '鲍威尔的讲话将释放未来货币政策方向的重要信号',
report_title: '鲍威尔讲话要点预测',
declare_date: '2025-10-19T00:00:00',
match_score: '好'
}
]
},
forecast: '预计维持利率不变,关注鲍威尔讲话基调',
fact: null,
related_stocks: [
[
'600036',
'招商银行',
{
data: [
{
author: '中信证券',
sentences: '作为国内领先的商业银行,招商银行对利率变化敏感度高,美联储货币政策调整将通过汇率、资本流动等渠道影响国内货币政策,进而影响银行净息差和资产质量',
query_part: '美联储政策通过汇率和资本流动影响国内银行业',
report_title: '美联储政策对中国银行业影响分析',
declare_date: '2025-10-18T00:00:00',
match_score: '好'
}
]
},
0.85
],
[
'601398',
'工商银行',
{
data: [
{
author: '招商证券',
sentences: '工商银行作为国有大行,其经营业绩与宏观经济和货币政策高度相关,美联储利率决策将影响全球流动性和人民币汇率,对大型商业银行的跨境业务和外汇敞口产生直接影响',
query_part: '美联储决策影响全球流动性和大行跨境业务',
report_title: '货币政策对银行业影响专题研究',
declare_date: '2025-10-17T00:00:00',
match_score: '好'
}
]
},
0.80
]
],
concepts: ['货币政策', '利率', '美联储'],
is_following: false
},
{
id: 502,
data_id: 502,
title: '央行货币政策委员会例会',
calendar_time: '2025-10-20T09:00:00Z',
type: 'event',
star: 4,
former: '本次例会将总结前期货币政策执行情况,研究部署下一阶段工作。重点关注经济增长、通胀水平和金融稳定等方面的形势变化。\n\n(AI合成)',
forecast: '可能释放适度宽松信号',
fact: null,
related_stocks: [],
concepts: ['货币政策', '央行', '宏观经济'],
is_following: true
},
{
id: 503,
data_id: 503,
title: '宁德时代业绩快报',
calendar_time: '2025-10-20T16:00:00Z',
type: 'data',
star: 5,
former: {
data: [
{
author: 'SNE Research',
sentences: '公司Q3动力电池装机量持续保持全球第一市场份额达到37.8%较去年同期提升2.3个百分点,在全球动力电池市场继续保持领先地位,主要得益于国内新能源汽车市场的强劲增长以及海外客户订单的持续放量',
query_part: '公司Q3动力电池装机量持续保持全球第一',
report_title: '全球动力电池市场装机量统计报告',
declare_date: '2025-10-10T00:00:00',
match_score: '好'
},
{
author: '宁德时代',
sentences: '储能业务订单饱满预计全年营收同比增长超过60%,公司储能产品已应用于全球多个大型储能项目,在用户侧储能、电网侧储能等领域均实现突破,随着全球能源转型加速,储能市场需求持续旺盛',
query_part: '储能业务订单饱满预计全年营收同比增长超过60%',
report_title: '宁德时代2024年业绩预告',
declare_date: '2025-09-30T00:00:00',
match_score: '好'
}
]
},
forecast: '预计营收和净利润双增长',
fact: null,
related_stocks: [
[
'300750',
'宁德时代',
{
data: [
{
author: '宁德时代公告',
sentences: '公司Q3动力电池装机量持续保持全球第一市场份额达到37.8%较去年同期提升2.3个百分点,在全球动力电池市场继续保持领先地位,主要得益于国内新能源汽车市场的强劲增长以及海外客户订单的持续放量',
query_part: '动力电池装机量全球第一市场份额37.8%',
report_title: '宁德时代2024年Q3业绩快报',
declare_date: '2025-10-15T00:00:00',
match_score: '优'
},
{
author: '国泰君安证券',
sentences: '储能业务订单饱满预计全年营收同比增长超过60%,公司储能产品已应用于全球多个大型储能项目,在用户侧储能、电网侧储能等领域均实现突破',
query_part: '储能业务营收同比增长超60%',
report_title: '宁德时代储能业务深度报告',
declare_date: '2025-10-12T00:00:00',
match_score: '优'
}
]
},
0.95
],
[
'002466',
'天齐锂业',
{
data: [
{
author: '天风证券',
sentences: '天齐锂业作为宁德时代的核心供应商,将直接受益于下游动力电池需求的增长,公司锂资源储量丰富,随着宁德时代产能扩张,锂盐需求持续旺盛,公司业绩增长确定性强',
query_part: '核心锂供应商直接受益于下游需求增长',
report_title: '天齐锂业:受益动力电池产业链景气',
declare_date: '2025-10-14T00:00:00',
match_score: '好'
}
]
},
0.82
]
],
concepts: ['新能源', '动力电池', '储能'],
is_following: false
}
];
export const mockCalendarEvents = [
{
id: 401,
@@ -497,3 +668,52 @@ export function getCalendarEventsByDateRange(userId, startDate, endDate) {
return eventDate >= start && eventDate <= end;
});
}
// ==================== 未来事件(投资日历)辅助函数 ====================
/**
* 获取指定日期的未来事件列表
* @param {string} dateStr - 日期字符串 'YYYY-MM-DD'
* @param {string} type - 事件类型 'event' | 'data' | 'all'
* @returns {Array} 事件列表
*/
export function getMockFutureEvents(dateStr, type = 'all') {
const targetDate = new Date(dateStr);
return mockFutureEvents.filter(event => {
const eventDate = new Date(event.calendar_time);
const isSameDate =
eventDate.getFullYear() === targetDate.getFullYear() &&
eventDate.getMonth() === targetDate.getMonth() &&
eventDate.getDate() === targetDate.getDate();
if (!isSameDate) return false;
if (type === 'all') return true;
return event.type === type;
});
}
/**
* 获取指定月份的事件统计
* @param {number} year - 年份
* @param {number} month - 月份 (1-12)
* @returns {Array} 事件统计数组
*/
export function getMockEventCountsForMonth(year, month) {
const counts = {};
mockFutureEvents.forEach(event => {
const eventDate = new Date(event.calendar_time);
if (eventDate.getFullYear() === year && eventDate.getMonth() + 1 === month) {
const dateStr = eventDate.toISOString().split('T')[0];
counts[dateStr] = (counts[dateStr] || 0) + 1;
}
});
return Object.entries(counts).map(([date, count]) => ({
date,
count,
className: count >= 3 ? 'high-activity' : count >= 2 ? 'medium-activity' : 'low-activity'
}));
}

View File

@@ -91,8 +91,18 @@ export function generateWechatSessionId() {
// 设置当前登录用户
export function setCurrentUser(user) {
if (user) {
localStorage.setItem('mock_current_user', JSON.stringify(user));
console.log('[Mock State] 设置当前登录用户:', user);
// 数据兼容处理:确保用户数据包含订阅信息字段
const normalizedUser = {
...user,
// 如果缺少订阅信息,添加默认值
subscription_type: user.subscription_type || 'free',
subscription_status: user.subscription_status || 'active',
subscription_end_date: user.subscription_end_date || null,
is_subscription_active: user.is_subscription_active !== false,
subscription_days_left: user.subscription_days_left || 0
};
localStorage.setItem('mock_current_user', JSON.stringify(normalizedUser));
console.log('[Mock State] 设置当前登录用户:', normalizedUser);
}
}