feat: 投诉仅限本人邀请人+人工客服配置+抢单池商家成交指标

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-27 01:41:29 +08:00
parent 0e102fbcba
commit 9ac0a3a5ad
7 changed files with 333 additions and 90 deletions

View File

@@ -163,7 +163,7 @@ class DashouDingdanHuoquView(APIView):
'AssignedID', 'AssignedResponse', 'AssignedResponseAt', 'AssignedLaterNote',
'ProductTypeID', 'ImageURL', 'GrabRequirement',
'MembershipID', 'CommissionReq', 'Description', 'Remark', 'CreateTime',
'MerchantNickname'
'MerchantNickname', 'ClubID',
)
# 10. 转换为列表
@@ -308,6 +308,28 @@ class DashouDingdanHuoquView(APIView):
identity_tag_map = batch_identity_tags(club_id, identity_pairs) if identity_pairs else {}
# --- 商家成交指标(有样本才返回) ---
merchant_stat_map = {}
if merchant_uids:
try:
from jituan.services.deal_stats import batch_pool_merchant_stats
order_club_by_merchant = {}
for item in dingdan_list:
if item['Platform'] != 2:
continue
oid = item['OrderID']
sj = shangjia_id_map.get(oid)
if not sj:
continue
ocid = (item.get('ClubID') or club_id or '').strip()
if sj not in order_club_by_merchant and ocid:
order_club_by_merchant[sj] = ocid
merchant_stat_map = batch_pool_merchant_stats(
club_id, merchant_uids, order_club_map=order_club_by_merchant,
)
except Exception as e:
logger.error(f"批量商家成交指标失败: {e}", exc_info=True)
# 12. 格式化返回数据
formatted_list = []
for order in dingdan_list:
@@ -320,7 +342,7 @@ class DashouDingdanHuoquView(APIView):
order, yonghuid, club_id=club_id, user_clumber=user_clumber,
)
)
formatted_list.append({
row = {
'dingdan_id': order['OrderID'],
'zhuangtai': order['Status'],
'pingtai': order['Platform'],
@@ -353,7 +375,10 @@ class DashouDingdanHuoquView(APIView):
'shangjia_identity_biaoqian': identity_tag_map.get((sj_uid, SHENFEN_SHANGJIA), []) if sj_uid else [],
'zhiding_identity_biaoqian': identity_tag_map.get((zid, SHENFEN_DASHOU), []) if zid else [],
'shangjia_youzhi': bool(youzhi_map.get(sj_uid)) if sj_uid else False,
})
}
if sj_uid and sj_uid in merchant_stat_map:
row['shangjia_deal_stat'] = merchant_stat_map[sj_uid]
formatted_list.append(row)
has_more = (page * page_size) < total