feat(fulfillment): 增加工作台状态事件同步
This commit is contained in:
@@ -12,6 +12,7 @@ from sqlalchemy.orm import Session
|
||||
from ..database import get_db
|
||||
from ..schemas import (
|
||||
PlatformFulfillmentCustomerBindingAction,
|
||||
PlatformFulfillmentCustomerSessionBatchRequest,
|
||||
PlatformFulfillmentCustomerSessionRequest,
|
||||
)
|
||||
from ..services.platform_fulfillment import service
|
||||
@@ -32,6 +33,18 @@ def require_integration_key(
|
||||
raise HTTPException(status_code=401, detail="直播账号履约集成鉴权失败")
|
||||
|
||||
|
||||
@router.post(
|
||||
"/events/order-sync",
|
||||
dependencies=[Depends(require_integration_key)],
|
||||
)
|
||||
def sync_order_event(
|
||||
payload: dict[str, Any],
|
||||
db: Session = Depends(get_db),
|
||||
) -> dict[str, Any]:
|
||||
del payload
|
||||
return service.sync_pending_tasks(db, limit=500)
|
||||
|
||||
|
||||
@router.post(
|
||||
"/customer-sessions/ensure", dependencies=[Depends(require_integration_key)]
|
||||
)
|
||||
@@ -73,6 +86,17 @@ def get_customer_binding_status(
|
||||
return service.customer_refresh_binding(db, task_id=task_id)
|
||||
|
||||
|
||||
@router.post(
|
||||
"/customer-sessions/status/batch",
|
||||
dependencies=[Depends(require_integration_key)],
|
||||
)
|
||||
def get_customer_binding_statuses(
|
||||
req: PlatformFulfillmentCustomerSessionBatchRequest,
|
||||
db: Session = Depends(get_db),
|
||||
) -> dict[str, Any]:
|
||||
return service.customer_refresh_bindings(db, task_ids=req.task_ids)
|
||||
|
||||
|
||||
@router.post(
|
||||
"/customer-sessions/{task_id}/binding/confirm",
|
||||
dependencies=[Depends(require_integration_key)],
|
||||
|
||||
Reference in New Issue
Block a user