update pay ui
This commit is contained in:
@@ -345,10 +345,30 @@ const ConceptTimelineModal = ({
|
|||||||
const fetchNews = async () => {
|
const fetchNews = async () => {
|
||||||
try {
|
try {
|
||||||
// 提取股票代码列表
|
// 提取股票代码列表
|
||||||
const stockCodes = (stocks || [])
|
let stockCodes = (stocks || [])
|
||||||
.map(s => s.code || s.stock_code)
|
.map(s => s.code || s.stock_code)
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
|
|
||||||
|
// 如果 stocks 为空但有 conceptId,尝试从概念详情接口获取股票列表
|
||||||
|
if (stockCodes.length === 0 && conceptId) {
|
||||||
|
logger.info('ConceptTimelineModal', '股票列表为空,尝试从概念详情接口获取', { conceptId, conceptName });
|
||||||
|
try {
|
||||||
|
const detailRes = await fetch(`${API_BASE_URL}/concept/${encodeURIComponent(conceptId)}`);
|
||||||
|
if (detailRes.ok) {
|
||||||
|
const detailData = await detailRes.json();
|
||||||
|
const detailStocks = detailData.stocks || [];
|
||||||
|
stockCodes = detailStocks
|
||||||
|
.map(s => s.code || s.stock_code)
|
||||||
|
.filter(Boolean);
|
||||||
|
logger.info('ConceptTimelineModal', `从概念详情获取到 ${stockCodes.length} 只股票`, { conceptId });
|
||||||
|
} else {
|
||||||
|
logger.warn('ConceptTimelineModal', '获取概念详情失败', { conceptId, status: detailRes.status });
|
||||||
|
}
|
||||||
|
} catch (detailErr) {
|
||||||
|
logger.error('ConceptTimelineModal', '获取概念详情异常', detailErr, { conceptId });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (stockCodes.length === 0) {
|
if (stockCodes.length === 0) {
|
||||||
logger.warn('ConceptTimelineModal', '概念没有关联股票,无法获取新闻', { conceptName });
|
logger.warn('ConceptTimelineModal', '概念没有关联股票,无法获取新闻', { conceptName });
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
Reference in New Issue
Block a user