fix: 组队强制本俱乐部隔离,修复组队分账冻结幂等键

组队接口一律校验 X-Club-Id=订单=帖;不走跨店互通。分账 biz_id 按队员区分。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-27 03:25:52 +08:00
parent 193a82930e
commit 454f5abe90
3 changed files with 85 additions and 29 deletions

View File

@@ -293,6 +293,7 @@ def credit_dashou_order_settle(
amount,
set_idle_status: bool = False,
increment_chengjiao: bool = True,
settle_biz_id: str = '',
) -> Dict[str, Any]:
"""
打手订单结算专用入账P1
@@ -300,6 +301,7 @@ def credit_dashou_order_settle(
- 可提现走 credit_role_balance未开冻结=全额进 yue与改造前一致
- zonge / 今日今月收益仍按「全额」累加(统计口径不变)
- 成交单量 +1、可选置空闲状态
- settle_biz_id组队多人分账时传入 `{order_id}:team:{uid}`,避免同单幂等撞键
调用方须已在 transaction.atomic() 内;本函数用 F() 更新,勿再对同一 profile save 覆盖余额字段。
"""
from users.models import UserDashou
@@ -307,6 +309,7 @@ def credit_dashou_order_settle(
credit = _money(amount)
order_id = str(getattr(order, 'OrderID', None) or getattr(order, 'order_id', '') or '')
cid = order_club_id(order)
biz_id = (settle_biz_id or order_id or '').strip()
if credit <= 0:
updates = {}
@@ -329,7 +332,7 @@ def credit_dashou_order_settle(
role=ROLE_DASHOU,
amount=credit,
source_type=SOURCE_ORDER_SETTLE,
biz_id=order_id,
biz_id=biz_id,
profile=dashou_profile,
order_id=order_id,
freeze_reason=f'订单结算 {order_id}',