Renamed AuthRequired/AdminRequired to auth_required/admin_required and updated all references. Replaced direct HTTPException usage with utils.http_exceptions for consistent error handling. Updated router endpoints to use new auth dependency and standardized not implemented responses. Cleaned up unused theme fields in SiteConfigResponse and improved site config endpoint. Minor type and import cleanups across routers and middleware.
106 lines
3.0 KiB
Python
106 lines
3.0 KiB
Python
from fastapi import APIRouter, Depends
|
|
|
|
from middleware.auth import auth_required
|
|
from models import ResponseBase
|
|
from utils import http_exceptions
|
|
|
|
vas_router = APIRouter(
|
|
prefix="/vas",
|
|
tags=["vas"]
|
|
)
|
|
|
|
@vas_router.get(
|
|
path='/pack',
|
|
summary='获取容量包及配额信息',
|
|
description='Get information about storage packs and quotas.',
|
|
dependencies=[Depends(auth_required)]
|
|
)
|
|
def router_vas_pack() -> ResponseBase:
|
|
"""
|
|
Get information about storage packs and quotas.
|
|
|
|
Returns:
|
|
ResponseBase: A model containing the response data for storage packs and quotas.
|
|
"""
|
|
http_exceptions.raise_not_implemented()
|
|
|
|
@vas_router.get(
|
|
path='/product',
|
|
summary='获取商品信息,同时返回支付信息',
|
|
description='Get product information along with payment details.',
|
|
dependencies=[Depends(auth_required)]
|
|
)
|
|
def router_vas_product() -> ResponseBase:
|
|
"""
|
|
Get product information along with payment details.
|
|
|
|
Returns:
|
|
ResponseBase: A model containing the response data for products and payment information.
|
|
"""
|
|
http_exceptions.raise_not_implemented()
|
|
|
|
@vas_router.post(
|
|
path='/order',
|
|
summary='新建支付订单',
|
|
description='Create an order for a product.',
|
|
dependencies=[Depends(auth_required)]
|
|
)
|
|
def router_vas_order() -> ResponseBase:
|
|
"""
|
|
Create an order for a product.
|
|
|
|
Returns:
|
|
ResponseBase: A model containing the response data for the created order.
|
|
"""
|
|
http_exceptions.raise_not_implemented()
|
|
|
|
@vas_router.get(
|
|
path='/order/{id}',
|
|
summary='查询订单状态',
|
|
description='Get information about a specific payment order by ID.',
|
|
dependencies=[Depends(auth_required)]
|
|
)
|
|
def router_vas_order_get(id: str) -> ResponseBase:
|
|
"""
|
|
Get information about a specific payment order by ID.
|
|
|
|
Args:
|
|
id (str): The ID of the order to retrieve information for.
|
|
|
|
Returns:
|
|
ResponseBase: A model containing the response data for the specified order.
|
|
"""
|
|
http_exceptions.raise_not_implemented()
|
|
|
|
@vas_router.get(
|
|
path='/redeem',
|
|
summary='获取兑换码信息',
|
|
description='Get information about a specific redemption code.',
|
|
dependencies=[Depends(auth_required)]
|
|
)
|
|
def router_vas_redeem(code: str) -> ResponseBase:
|
|
"""
|
|
Get information about a specific redemption code.
|
|
|
|
Args:
|
|
code (str): The redemption code to retrieve information for.
|
|
|
|
Returns:
|
|
ResponseBase: A model containing the response data for the specified redemption code.
|
|
"""
|
|
http_exceptions.raise_not_implemented()
|
|
|
|
@vas_router.post(
|
|
path='/redeem',
|
|
summary='执行兑换',
|
|
description='Redeem a redemption code for a product or service.',
|
|
dependencies=[Depends(auth_required)]
|
|
)
|
|
def router_vas_redeem_post() -> ResponseBase:
|
|
"""
|
|
Redeem a redemption code for a product or service.
|
|
|
|
Returns:
|
|
ResponseBase: A model containing the response data for the redeemed code.
|
|
"""
|
|
http_exceptions.raise_not_implemented() |