feat: 重做协作台账状态机并支持充值核账
This commit is contained in:
@@ -57,6 +57,8 @@ from ...schemas import (
|
||||
HuyaExternalOrderListOut,
|
||||
HuyaExternalOrderOut,
|
||||
HuyaExternalOrderOwnerOut,
|
||||
HuyaExternalOrderRechargeOut,
|
||||
HuyaExternalOrderRechargeRequest,
|
||||
HuyaExternalOrderStatusBatchOut,
|
||||
HuyaExternalOrderStatusBatchRequest,
|
||||
HuyaExternalOrderStatusRequest,
|
||||
@@ -317,6 +319,7 @@ def create_external_order(
|
||||
ck_text=req.ck_text,
|
||||
bind_douyu_account=req.bind_douyu_account,
|
||||
gift_name=req.gift_name,
|
||||
required_points=req.required_points,
|
||||
home_images=req.home_images,
|
||||
remark=req.remark,
|
||||
require_verified=req.require_verified,
|
||||
@@ -374,6 +377,27 @@ def preview_external_order_ck(
|
||||
return preview
|
||||
|
||||
|
||||
@router.post("/external-orders/recharge", response_model=HuyaExternalOrderRechargeOut)
|
||||
def recharge_external_orders(
|
||||
req: HuyaExternalOrderRechargeRequest,
|
||||
db: Session = Depends(get_db),
|
||||
current: User = Depends(require_permission("huya:collab:edit")),
|
||||
):
|
||||
"""充值核账:按绑定账号整组校验 CK + 积分,整组落「已充值 / 积分异常」。"""
|
||||
try:
|
||||
orders = collab.list_orders_by_ids(db, req.ids)
|
||||
result = collab.check_recharge_groups(
|
||||
db,
|
||||
current,
|
||||
orders,
|
||||
threshold=req.threshold,
|
||||
)
|
||||
except collab.CollabError as exc:
|
||||
raise _http_error(exc) from exc
|
||||
_publish_change(current, scope="orders", action="orders.recharge")
|
||||
return result
|
||||
|
||||
|
||||
@router.post(
|
||||
"/external-orders/status/batch", response_model=HuyaExternalOrderStatusBatchOut
|
||||
)
|
||||
@@ -384,8 +408,8 @@ def batch_update_external_order_status(
|
||||
):
|
||||
"""勾选多行一次改业务状态(单个也走这里)。
|
||||
|
||||
人工切换允许**往前跳步**(待处理 → 已上脚本),回退要带 ``rollback=true``;
|
||||
某一行前置校验没过(如没主页截图不能进「已确认绑定」)只记在这一条的 ``message`` 里。
|
||||
人工切换允许**往前跳步**(待补资料 → 已上脚本),回退要带 ``rollback=true``;
|
||||
「已充值 / 积分异常」不走这里,必须用 ``POST /external-orders/recharge`` 整组核账。
|
||||
"""
|
||||
try:
|
||||
orders = collab.list_orders_by_ids(db, req.ids)
|
||||
|
||||
Reference in New Issue
Block a user