Files
Neo-ZQYY/apps/backend/app/routers/xcx_config.py

38 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
配置路由CONFIG-1 技能类型。
前缀 /api/xcx/config由 main.py 注册。
"""
from __future__ import annotations
import logging
from fastapi import APIRouter, Depends
from app.auth.dependencies import CurrentUser
from app.middleware.permission import require_approved
from app.schemas.xcx_config import SkillTypeItem
from app.services import fdw_queries
logger = logging.getLogger(__name__)
router = APIRouter(prefix="/api/xcx/config", tags=["xcx-config"])
@router.get("/skill-types", response_model=list[SkillTypeItem])
async def get_skill_types(
user: CurrentUser = Depends(require_approved()),
):
"""技能类型配置CONFIG-1。查询失败降级返回空数组。"""
try:
from app.database import get_connection
conn = get_connection()
try:
return fdw_queries.get_skill_types(conn, user.site_id)
finally:
conn.close()
except Exception:
logger.warning("CONFIG-1 技能类型查询失败,降级为空数组", exc_info=True)
return []