feat: 组队招募(/zudui)+ 结单/自动结算/罚款挂钩

新增 Team 表与接口;进8强制锁、组队分账优先且失败不回退全额队长。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-27 03:12:04 +08:00
parent e9e5ee85e2
commit 7002da6093
14 changed files with 1466 additions and 63 deletions

View File

@@ -54,6 +54,11 @@ def handle_order_status_8(sender, instance, **kwargs):
old = Order.query.filter(pk=instance.pk).values_list('Status', flat=True).first()
if old != 8 and instance.Status == 8:
apply_enter_status_8(instance)
try:
from orders.services.team_recruit import on_order_enter_status_8
on_order_enter_status_8(instance)
except Exception as e:
logger.error(f'组队进结算中锁定失败: {e}')
elif old == 8 and instance.Status != 8:
# 成交时长:在清空 SettlementTime 前挂到实例上供 post_save 指标使用
instance._deal_settle_started_at = instance.SettlementTime
@@ -77,5 +82,10 @@ def handle_order_deal_stats(sender, instance, created, **kwargs):
ds.on_order_completed(instance, settle_started_at=started)
elif instance.Status == 5:
ds.on_order_refunded(instance)
try:
from orders.services.team_recruit import on_order_refunded
on_order_refunded(instance)
except Exception as e:
logger.error(f'组队退款清退失败: {e}')
except Exception as e:
logger.error(f'成交指标信号处理失败: {e}')