From 69e1ca0e1a90bf290ed84000753f75fdad816f48 Mon Sep 17 00:00:00 2001 From: XingQue Date: Mon, 27 Jul 2026 07:43:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BB=84=E9=98=9F=E5=A4=A7=E5=8E=85?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E9=98=9F=E9=95=BF=E7=BB=93=E7=AE=97=E7=8E=87?= =?UTF-8?q?/=E8=A2=AB=E7=BD=9A=E6=AC=BE=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 与订单列表同口径,按招募与订单俱乐部兜底查询打手成交统计。 Co-authored-by: Cursor --- orders/services/team_recruit.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/orders/services/team_recruit.py b/orders/services/team_recruit.py index b53ccf9..d034b39 100644 --- a/orders/services/team_recruit.py +++ b/orders/services/team_recruit.py @@ -623,7 +623,6 @@ def serialize_recruit_public(rec, order=None, *, include_game_ids=False) -> dict from orders.models import Order, MerchantOrderExt from jituan.services.order_deal import order_auto_settle_payload from jituan.models import DashouDealStat - from jituan.services.deal_stats import serialize_dashou_stat from users.business_models import User from backend.utils import fmt_datetime @@ -698,15 +697,24 @@ def serialize_recruit_public(rec, order=None, *, include_game_ids=False) -> dict except Exception: pass - row = DashouDealStat.query.filter(club_id=rec.club_id, dashou_uid=rec.leader_uid).first() - if row and int(row.order_count or 0) > 0: - s = serialize_dashou_stat(row) - data['leader_deal_stat'] = { - 'deal_rate': s['deal_rate'], - 'fined_rate': s['fined_rate'], - 'deal_rate_text': f"{round(s['deal_rate'] * 100, 1)}%", - 'fined_rate_text': f"{round(s['fined_rate'] * 100, 1)}%", - } + # 队长打手结算率/被罚款率(有样本才返回,与订单列表口径一致) + from jituan.services.deal_stats import miniapp_dashou_deal_payload + leader_uid = (rec.leader_uid or '').strip() + club_ids = [] + for cid in ( + (rec.club_id or '').strip(), + (getattr(order, 'ClubID', None) or '').strip() if order else '', + ): + if cid and cid not in club_ids: + club_ids.append(cid) + dashou_row = None + if leader_uid and club_ids: + for cid in club_ids: + dashou_row = DashouDealStat.query.filter(club_id=cid, dashou_uid=leader_uid).first() + if dashou_row and int(dashou_row.order_count or 0) > 0: + break + dashou_row = None + data['leader_deal_stat'] = miniapp_dashou_deal_payload(dashou_row) if include_game_ids: from orders.models import TeamMember