发布(0.4.6): 修复预售兑换记录判定与详情展示并新增工作台强制发放
This commit is contained in:
@@ -35,6 +35,7 @@ from ..schemas import (
|
||||
DouyuCollabArchiveRequest,
|
||||
DouyuCollabCkExportOut,
|
||||
DouyuCollabCkExportRequest,
|
||||
DouyuCollabExchangeRecordsOut,
|
||||
DouyuCollabGiftCreate,
|
||||
DouyuCollabGiftOut,
|
||||
DouyuCollabGiftUpdate,
|
||||
@@ -721,6 +722,40 @@ def external_order_metrics(
|
||||
return collab.order_metrics(db, order_id)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/external-orders/{order_id}/exchange-records",
|
||||
response_model=DouyuCollabExchangeRecordsOut,
|
||||
)
|
||||
def get_external_order_exchange_records(
|
||||
order_id: int,
|
||||
db: Session = Depends(get_db),
|
||||
current: User = Depends(require_permission("douyu:collab:view")),
|
||||
):
|
||||
"""查看订单关联斗鱼账号已缓存的兑换记录。"""
|
||||
try:
|
||||
order = collab.get_order(db, order_id)
|
||||
return collab.list_order_exchange_records(db, current, order, refresh=False)
|
||||
except collab.CollabError as exc:
|
||||
raise _http_error(exc) from exc
|
||||
|
||||
|
||||
@router.post(
|
||||
"/external-orders/{order_id}/exchange-records/query",
|
||||
response_model=DouyuCollabExchangeRecordsOut,
|
||||
)
|
||||
def query_external_order_exchange_records(
|
||||
order_id: int,
|
||||
db: Session = Depends(get_db),
|
||||
current: User = Depends(require_permission("douyu:collab:edit")),
|
||||
):
|
||||
"""实时向斗鱼拉取兑换记录并展示明细,不自动修改订单状态。"""
|
||||
try:
|
||||
order = collab.get_order(db, order_id)
|
||||
return collab.list_order_exchange_records(db, current, order, refresh=True)
|
||||
except collab.CollabError as exc:
|
||||
raise _http_error(exc) from exc
|
||||
|
||||
|
||||
@router.delete("/external-orders/{order_id}")
|
||||
def delete_external_order(
|
||||
order_id: int,
|
||||
|
||||
Reference in New Issue
Block a user