refactor: 删除板块资金流向,题材板块功能更全
- 删除前端 /sectors 页面、首页入口按钮、stock-api 板块类型与 fetchSectors - 删除后端 /api/sectors 路由,main.py 移除注册 - eastmoney.py 移除板块数据段(_fetch_push2/_fetch_akshare/UT令牌管理), 清理重复 import 与无用 datetime 子导入 - mootdx.py 移除板块降级方案(fetch_sector_list) - routeTree.gen.ts 由 build 自动重新生成,移除 sectors 路由 题材热点/热点穿透/核心股已覆盖板块能力,功能更全,板块资金流向不再需要 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
"""板块数据路由:行业板块、概念板块"""
|
||||
|
||||
from fastapi import APIRouter, Query, HTTPException
|
||||
from fastapi.responses import JSONResponse
|
||||
from services import eastmoney, mootdx
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
# 行业/概念通过 query 参数区分,但上游反代/CDN 可能按 path 缓存而忽略 query,
|
||||
# 导致两个 tab 返回相同数据。显式禁止缓存,保证按 query 区分。
|
||||
_NO_CACHE_HEADERS = {"Cache-Control": "no-store, no-cache, must-revalidate, max-age=0"}
|
||||
|
||||
|
||||
@router.get("", summary="板块列表")
|
||||
async def sector_list(
|
||||
type: str = Query("industry", description="板块类型:industry=行业板块, concept=概念板块"),
|
||||
):
|
||||
if type not in ("industry", "concept"):
|
||||
raise HTTPException(status_code=400, detail="板块类型错误,仅支持 industry/concept")
|
||||
|
||||
data = await eastmoney.fetch_sector_list(type)
|
||||
if data:
|
||||
return JSONResponse(
|
||||
{"data": data, "count": len(data), "type": type},
|
||||
headers=_NO_CACHE_HEADERS,
|
||||
)
|
||||
|
||||
# 降级:通达信 mootdx(不含实时资金流数据)
|
||||
md_data = await mootdx.fetch_sector_list(type)
|
||||
if md_data:
|
||||
return JSONResponse(
|
||||
{"data": md_data, "count": len(md_data), "type": type, "source": "mootdx"},
|
||||
headers=_NO_CACHE_HEADERS,
|
||||
)
|
||||
|
||||
return JSONResponse(
|
||||
{"data": [], "count": 0, "type": type},
|
||||
headers=_NO_CACHE_HEADERS,
|
||||
)
|
||||
Reference in New Issue
Block a user