perf(douyu): 优化自动化中心运行总览加载
This commit is contained in:
@@ -69,6 +69,7 @@ from ..services.account_binding import BIND_BOUND, bind_payload
|
||||
from ..services.account_observability import (
|
||||
account_platform_status,
|
||||
account_platform_trends,
|
||||
account_supply_snapshot,
|
||||
)
|
||||
from ..services.account_protection_service import (
|
||||
evaluate_protection_targets,
|
||||
@@ -766,11 +767,18 @@ def task_types(current: User = Depends(require_permission("douyu:task"))):
|
||||
@router.get("/account-platform-status")
|
||||
def get_account_platform_status(
|
||||
include_trends: bool = Query(True),
|
||||
include_supply: bool = Query(True),
|
||||
include_diagnostics: bool = Query(True),
|
||||
db: Session = Depends(get_db),
|
||||
current: User = Depends(require_permission("douyu:task")),
|
||||
):
|
||||
"""账号同步、CK 周期、商品覆盖和供给缺口的统一观测快照。"""
|
||||
return account_platform_status(db, include_trends=include_trends)
|
||||
return account_platform_status(
|
||||
db,
|
||||
include_trends=include_trends,
|
||||
include_supply=include_supply,
|
||||
include_diagnostics=include_diagnostics,
|
||||
)
|
||||
|
||||
|
||||
@router.get("/account-platform-trends")
|
||||
@@ -782,6 +790,15 @@ def get_account_platform_trends(
|
||||
return account_platform_trends(db)
|
||||
|
||||
|
||||
@router.get("/account-platform-supply")
|
||||
def get_account_platform_supply(
|
||||
db: Session = Depends(get_db),
|
||||
current: User = Depends(require_permission("douyu:task")),
|
||||
):
|
||||
"""延迟加载账号供给库存,避免阻塞运行总览首屏。"""
|
||||
return account_supply_snapshot(db)
|
||||
|
||||
|
||||
@router.put(
|
||||
"/account-protection-targets/{group_key}",
|
||||
response_model=DouyuAccountProtectionTargetOut,
|
||||
|
||||
Reference in New Issue
Block a user