diff --git a/backend/api/routes/system.py b/backend/api/routes/system.py index 765b777..402fcfa 100644 --- a/backend/api/routes/system.py +++ b/backend/api/routes/system.py @@ -1300,20 +1300,32 @@ async def market_overview(_admin: Dict[str, Any] = Depends(require_system_admin) data["beta_filter_triggered"] = triggered # 策略执行概览:当前执行方案与配置项执行情况(易读文字) + get_strategy_execution_overview = None try: from market_overview import get_strategy_execution_overview except ImportError: try: from backend.market_overview import get_strategy_execution_overview except ImportError: - get_strategy_execution_overview = None + pass + if get_strategy_execution_overview is None: + try: + import sys + backend_dir = Path(__file__).resolve().parent.parent.parent + if str(backend_dir) not in sys.path: + sys.path.insert(0, str(backend_dir)) + from market_overview import get_strategy_execution_overview + except ImportError: + pass if get_strategy_execution_overview is not None: try: data["strategy_execution_overview"] = get_strategy_execution_overview() except Exception as e: data["strategy_execution_overview"] = {"sections": [{"title": "加载失败", "content": str(e)}]} else: - data["strategy_execution_overview"] = {"sections": []} + data["strategy_execution_overview"] = { + "sections": [{"title": "策略执行概览暂不可用", "content": "请确认后端已重启并已部署最新代码;若已重启仍无数据,请检查 backend/market_overview.py 与 config_manager 是否可正常导入。"}] + } return data diff --git a/frontend/src/components/GlobalConfig.jsx b/frontend/src/components/GlobalConfig.jsx index 71c06d1..03d706c 100644 --- a/frontend/src/components/GlobalConfig.jsx +++ b/frontend/src/components/GlobalConfig.jsx @@ -1303,21 +1303,27 @@ const GlobalConfig = () => { - {/* 策略执行概览:当前执行方案与配置项执行情况(易读文字) */} - {marketOverview.strategy_execution_overview?.sections?.length > 0 && ( -
- 以下为当前生效的整体策略执行标准与机制说明(由数据库/Redis 配置生成,刷新市场行情时一并更新)。 + {/* 策略执行概览:当前执行方案与配置项执行情况(易读文字),有数据则展示,无数据也显示区块并提示 */} +
+ 以下为当前生效的整体策略执行标准与机制说明(由数据库/Redis 配置生成,刷新市场行情时一并更新)。 +
+ {marketOverview.strategy_execution_overview.sections.map((sec, idx) => ( ++ 暂无数据。请点击上方「刷新」重试;若仍无内容,请确认后端已重启并已部署包含策略执行概览的最新代码。
- {marketOverview.strategy_execution_overview.sections.map((sec, idx) => ( -