feat: batch update - gift card breakdown spec, backend APIs, miniprogram pages, ETL finance recharge, docs & migrations
This commit is contained in:
37
apps/backend/app/routers/xcx_config.py
Normal file
37
apps/backend/app/routers/xcx_config.py
Normal file
@@ -0,0 +1,37 @@
|
||||
"""
|
||||
配置路由: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 []
|
||||
Reference in New Issue
Block a user