feat(ocr-dashboard): 透传按主体名跨批次采集记录接口

- ocr_dashboard_service.py 新增 list_collections_by_subject() 函数
- get_series() 增加 subject_name 参数
- app.py 新增路由 /api/v1/data-dashboard/ocr/batches/subject/<subject_name>/collections
- 透传代理至 xiaoti-framework crawler 服务
This commit is contained in:
2026-09-02 18:27:00 +08:00
parent fe15b11733
commit 26e91597ab
2 changed files with 22 additions and 2 deletions

View File

@@ -49,6 +49,16 @@ def list_collections(batch_key: str) -> list[dict[str, Any]]:
return _get(f"/xhs/ocr/batches/{batch_key.strip()}/collections") or []
def list_collections_by_subject(subject_name: str, start_date: str = "", end_date: str = "") -> list[dict[str, Any]]:
"""按主体名查询该主体下所有批次的采集任务。用于同名主体多批次合并展示。"""
if not subject_name.strip():
raise TaskError("OCR_SUBJECT_REQUIRED", "subject_name 不能为空", 422)
return _get(
f"/xhs/ocr/batches/subject/{subject_name.strip()}/collections",
{"start_date": start_date, "end_date": end_date},
) or []
def get_summary(batch_key: str = "", collection_key: str = "",
start_date: str = "", end_date: str = "") -> dict[str, Any]:
data = _get("/xhs/ocr/dashboard/summary", {
@@ -125,9 +135,9 @@ def _overlay_acceptance_questions(data: dict[str, Any], batch_key: str) -> dict[
return data
def get_series(batch_key: str = "", start_date: str = "", end_date: str = "") -> dict[str, Any]:
def get_series(batch_key: str = "", subject_name: str = "", start_date: str = "", end_date: str = "") -> dict[str, Any]:
return _get("/xhs/ocr/dashboard/series", {
"batch_key": batch_key, "start_date": start_date, "end_date": end_date,
"batch_key": batch_key, "subject_name": subject_name, "start_date": start_date, "end_date": end_date,
}) or {"items": [], "subjects": []}