fix: 超管强制结单跳过客服统计,避免 kefu 为 None 整单回滚

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-28 14:43:51 +08:00
parent bc20fd85e0
commit 4414b74119

View File

@@ -1903,11 +1903,12 @@ class KefuForceCompleteView(APIView):
if order.Platform == 2:
settle_shangjia_order_guanshi_fenhong(order, dashou_id)
# 8. 更新客服统计
kefu.jinrichuli = F('jinrichuli') + 1
kefu.jinyuechuli = F('jinyuechuli') + 1
kefu.zongchuli = F('zongchuli') + 1
kefu.save(update_fields=['jinrichuli', 'jinyuechuli', 'zongchuli'])
# 8. 更新客服统计(超管/管理员无 KefuProfile 时跳过,不影响结单)
if kefu is not None:
kefu.jinrichuli = F('jinrichuli') + 1
kefu.jinyuechuli = F('jinyuechuli') + 1
kefu.zongchuli = F('zongchuli') + 1
kefu.save(update_fields=['jinrichuli', 'jinyuechuli', 'zongchuli'])
return Response({'code': 0, 'msg': '强制结单成功'})