解决了部分detail load效率问题和load失败终止pipeline问题
This commit is contained in:
@@ -34,6 +34,7 @@ from schemas.project.project_base import (
|
||||
ProjectSettlementInvestment
|
||||
)
|
||||
from schemas.project.project import ProjectInfoResponse
|
||||
from schemas.project.project_aggregate import ProjectAggregateResponse
|
||||
|
||||
|
||||
_PROJECT_EXTENSION_FIELD_NAMES = {
|
||||
@@ -94,6 +95,23 @@ class ProjectApiHandler(BaseApiHandler):
|
||||
all_info = await api_get_project_all_info(client, project_id)
|
||||
cls._all_info_cache[project_id] = all_info
|
||||
return all_info
|
||||
|
||||
@classmethod
|
||||
async def get_aggregate(
|
||||
cls,
|
||||
client,
|
||||
project_id: str,
|
||||
*,
|
||||
domains: List[str],
|
||||
limit: int = 10000,
|
||||
) -> Dict[str, Any]:
|
||||
normalized_domains = tuple(dict.fromkeys(domains))
|
||||
return await api_get_project_aggregate(
|
||||
client,
|
||||
project_id,
|
||||
domains=list(normalized_domains),
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def clear_cache(cls):
|
||||
@@ -407,6 +425,27 @@ async def api_get_project_all_info(client, project_id: str) -> Dict[str, Any]:
|
||||
return validated.model_dump()
|
||||
|
||||
|
||||
async def api_get_project_aggregate(
|
||||
client,
|
||||
project_id: str,
|
||||
*,
|
||||
domains: List[str],
|
||||
limit: int = 10000,
|
||||
) -> Dict[str, Any]:
|
||||
"""POST /project/aggregate - 获取项目聚合数据(校验为 ProjectAggregateResponse)"""
|
||||
response = await client.request(
|
||||
method="POST",
|
||||
endpoint="/project/aggregate",
|
||||
data={"project_id": project_id, "domains": domains, "limit": limit},
|
||||
)
|
||||
code = response.get("code")
|
||||
if code != 200:
|
||||
raise Exception(f"API error {code}: {response.get('message', 'Unknown error')}")
|
||||
|
||||
validated = ProjectAggregateResponse.model_validate(response.get("data", {}))
|
||||
return validated.model_dump()
|
||||
|
||||
|
||||
async def api_update_project_base_info(client, data: Dict[str, Any], push_id: str, biz_id: str, *, steps: List[Dict[str, Any]] | None = None) -> None:
|
||||
"""PUT /project - 更新项目基本信息"""
|
||||
ProjectBaseInfoUpdate.model_validate(data)
|
||||
|
||||
Reference in New Issue
Block a user