""" 订阅计划路由。 """ from fastapi import APIRouter from app.core.openapi import error_responses from app.features.plan.deps import CurrentUserDep, PlanServiceDep from app.features.plan.schemas import CurrentPlanResponse, PlanResponse router = APIRouter( prefix="/api/plans", tags=["plans"], responses=error_responses(401, 404), ) @router.get("", response_model=list[PlanResponse]) def get_plans(service: PlanServiceDep) -> list[PlanResponse]: """获取所有可用的订阅计划(开发环境 ENABLE_TEST_PLAN=1 时包含「一分钱测试版」)。""" return service.get_plans_for_api() @router.get("/current", response_model=CurrentPlanResponse) async def get_current_plan( current_user: CurrentUserDep, service: PlanServiceDep, ) -> CurrentPlanResponse: """获取当前用户的订阅计划信息""" return await service.get_current_plan_response(current_user)