fix: 会员过期时跳过 API 请求 & 限制 STOMP WebSocket 重连次数
- DynamicNewsDetailPanel: 添加会员过期判断,过期时显示续费提示 - RelatedConceptsSection: 会员过期时跳过概念 API 请求 - TransmissionChainAnalysis: 会员过期时跳过传导链 API 请求 - BytedeskWidget: 限制 STOMP WebSocket 最多重连 3 次,屏蔽相关日志
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import { useSelector } from 'react-redux';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
@@ -39,6 +40,7 @@ import CitedContent from '../../../components/Citation/CitedContent';
|
||||
import { logger } from '../../../utils/logger';
|
||||
import { getApiBase } from '../../../utils/apiConfig';
|
||||
import { PROFESSIONAL_COLORS } from '../../../constants/professionalTheme';
|
||||
import { selectSubscriptionInfo } from '../../../store/slices/subscriptionSlice';
|
||||
|
||||
// 节点样式配置 - 完全复刻Flask版本
|
||||
const NODE_STYLES = {
|
||||
@@ -460,6 +462,10 @@ function getSankeyOption(data) {
|
||||
}
|
||||
|
||||
const TransmissionChainAnalysis = ({ eventId }) => {
|
||||
// 获取订阅信息,用于判断会员是否过期
|
||||
const subscriptionInfo = useSelector(selectSubscriptionInfo);
|
||||
const isSubscriptionExpired = subscriptionInfo.type !== 'free' && !subscriptionInfo.is_active;
|
||||
|
||||
// 状态管理
|
||||
const [graphData, setGraphData] = useState(null);
|
||||
const [sankeyData, setSankeyData] = useState(null);
|
||||
@@ -474,7 +480,7 @@ const TransmissionChainAnalysis = ({ eventId }) => {
|
||||
const [stats, setStats] = useState({
|
||||
totalNodes: 0,
|
||||
involvedIndustries: 0,
|
||||
relatedCompanies: 0,
|
||||
relatedCompanies: 0,
|
||||
positiveImpact: 0,
|
||||
negativeImpact: 0,
|
||||
circularEffect: 0
|
||||
@@ -514,9 +520,18 @@ const TransmissionChainAnalysis = ({ eventId }) => {
|
||||
}
|
||||
}, [graphData]);
|
||||
|
||||
// 加载数据
|
||||
// 加载数据 - 如果会员过期则跳过 API 请求
|
||||
useEffect(() => {
|
||||
async function fetchData() {
|
||||
// 会员已过期,不发起 API 请求
|
||||
if (isSubscriptionExpired) {
|
||||
logger.debug('TransmissionChain', '会员已过期,跳过传导链数据加载', { eventId });
|
||||
setLoading(false);
|
||||
setGraphData(null);
|
||||
setSankeyData(null);
|
||||
return;
|
||||
}
|
||||
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
@@ -563,7 +578,7 @@ const TransmissionChainAnalysis = ({ eventId }) => {
|
||||
if (eventId) {
|
||||
fetchData();
|
||||
}
|
||||
}, [eventId]);
|
||||
}, [eventId, isSubscriptionExpired]);
|
||||
|
||||
// BFS路径查找 - 完全复刻Flask版本
|
||||
function findPath(nodes, edges, fromId, toId) {
|
||||
|
||||
Reference in New Issue
Block a user