| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- from fastapi import APIRouter
- from app.api.endpoints import (
- account,
- agent,
- auth,
- common,
- config,
- node_configuration,
- email,
- notification,
- order,
- payment,
- plugin,
- product,
- provider,
- proxy,
- slot,
- sms,
- task,
- ticket,
- user,
- vas_task,
- webhook,
- )
- # 公共路由
- public_router = APIRouter()
- # 受保护路由
- protected_router = APIRouter()
- # 管理员级别路由
- admin_required_router = APIRouter()
- # 模块列表
- _modules = [
- account,
- agent,
- auth,
- common,
- config,
- node_configuration,
- email,
- notification,
- order,
- payment,
- plugin,
- product,
- provider,
- 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)
|