fix: 抢单/组队卡片成交指标有字段即返回,均时含0样本
商家指标俱乐部兜底;组队大厅附带商家成交率/罚款率/均时。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -883,6 +883,7 @@ def serialize_recruit_public(rec, order=None, *, include_game_ids=False) -> dict
|
||||
'sj_avatar': '',
|
||||
'leader_avatar': '',
|
||||
'leader_deal_stat': None,
|
||||
'shangjia_deal_stat': None,
|
||||
}
|
||||
if order:
|
||||
data['fadanpingtai_text'] = '平台单' if order.Platform == 1 else ('商家单' if order.Platform == 2 else '')
|
||||
@@ -941,6 +942,22 @@ def serialize_recruit_public(rec, order=None, *, include_game_ids=False) -> dict
|
||||
dashou_row = None
|
||||
data['leader_deal_stat'] = miniapp_dashou_deal_payload(dashou_row)
|
||||
|
||||
# 商家单:附带商家成交率/罚款率/均时(有样本才有;前端有哪个展示哪个)
|
||||
try:
|
||||
from jituan.services.deal_stats import miniapp_merchant_deal_payload
|
||||
from jituan.models import MerchantDealStat
|
||||
sj_uid = (data.get('shangjia_id') or '').strip()
|
||||
if sj_uid and club_ids:
|
||||
m_row = None
|
||||
for cid in club_ids:
|
||||
m_row = MerchantDealStat.query.filter(club_id=cid, merchant_uid=sj_uid).first()
|
||||
if m_row and int(m_row.order_count or 0) > 0:
|
||||
break
|
||||
m_row = None
|
||||
data['shangjia_deal_stat'] = miniapp_merchant_deal_payload(m_row)
|
||||
except Exception:
|
||||
data['shangjia_deal_stat'] = None
|
||||
|
||||
if include_game_ids:
|
||||
from orders.models import TeamMember
|
||||
from users.business_models import User
|
||||
|
||||
Reference in New Issue
Block a user