Files
auv/backend/routes/sectors.py
T
2026-07-05 21:29:17 +08:00

18 lines
597 B
Python

"""板块数据路由:行业板块、概念板块"""
from fastapi import APIRouter, Query, HTTPException
from services import eastmoney
router = APIRouter()
@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)
return {"data": data, "count": len(data), "type": type}