删除冗余的函数

This commit is contained in:
jingrow 2025-10-29 20:38:08 +08:00
parent 232dd80671
commit e06566c3fc

View File

@ -136,19 +136,10 @@ async def _process_whitelist_call(request: Request, full_module_path: str):
@router.api_route("/{module_path:path}", methods=["GET", "POST", "PUT", "DELETE"])
async def handle_request(request: Request, module_path: str):
"""
兼容旧路径直接传入完整点分路径 '<package.module.function>'
直接传入完整点分路径 '<package.module.function>'
"""
return await _process_whitelist_call(request, module_path)
@router.api_route("/{app}/{module_path:path}", methods=["GET", "POST", "PUT", "DELETE"])
async def handle_request_with_app_prefix(request: Request, app: str, module_path: str):
"""
新路径支持以 app 作为前缀例如 app.module.function
"""
full_module_path = f"{app}.{module_path}"
return await _process_whitelist_call(request, full_module_path)
def parse_module_path(module_path: str) -> Dict[str, str]:
"""解析模块路径"""
parts = module_path.split('.')