| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- from fastapi import APIRouter
- from app.api.endpoints import (
- account,
- auth,
- common,
- config,
- email,
- notification,
- order,
- payment,
- product,
- proxy,
- slot,
- sms,
- task,
- ticket,
- user,
- vas_task,
- webhook,
- )
- # 公共路由
- public_router = APIRouter()
- # 受保护路由
- protected_router = APIRouter()
- # 管理员级别路由
- admin_required_router = APIRouter()
- # 模块列表
- _modules = [
- account,
- auth,
- common,
- config,
- email,
- notification,
- order,
- payment,
- product,
- proxy,
- slot,
- sms,
- task,
- ticket,
- user,
- vas_task,
- webhook,
- ]
- # 注册所有子模块路由
- for _mod in _modules:
- if hasattr(_mod, "public_router") and _mod.public_router.routes:
- public_router.include_router(_mod.public_router)
- if hasattr(_mod, "protected_router") and _mod.protected_router.routes:
- protected_router.include_router(_mod.protected_router)
- if hasattr(_mod, "admin_required_router") and _mod.admin_required_router.routes:
- admin_required_router.include_router(_mod.admin_required_router)
|