Merge branch 'refactor/backend-architecture' into development

This commit is contained in:
yangshilin
2026-03-18 17:18:23 +08:00
parent 2070a03d35
commit 48b70e1350
266 changed files with 12386 additions and 9690 deletions

View File

@@ -0,0 +1,36 @@
"""
订阅计划路由。
"""
from typing import List
from fastapi import APIRouter, Depends
from app.core.dependencies import get_current_user
from app.features.plan.deps import get_plan_service
from app.features.plan.schemas import CurrentPlanResponse, PlanResponse
from app.features.plan.service import PlanService, get_plans_for_api
from app.features.user.models import User
router = APIRouter(
prefix="/api/plans",
tags=["plans"],
responses={
401: {"description": "认证失败"},
404: {"description": "资源不存在"},
},
)
@router.get("", response_model=List[PlanResponse])
async def get_plans():
"""获取所有可用的订阅计划(开发环境 ENABLE_TEST_PLAN=1 时包含「一分钱测试版」)。"""
return get_plans_for_api()
@router.get("/current", response_model=CurrentPlanResponse)
async def get_current_plan(
current_user: User = Depends(get_current_user),
service: PlanService = Depends(get_plan_service),
):
"""获取当前用户的订阅计划信息"""
return await service.get_current_plan_response(current_user)