From b02b2dffed3edebd489c726ce4e6339ea224a238 Mon Sep 17 00:00:00 2001 From: XingQue Date: Sat, 11 Jul 2026 00:06:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8F=90=E7=8E=B0=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E6=94=BE=E8=A1=8C=E9=80=80=E6=AC=BE=E5=AE=A1=E6=A0=B8=E4=B8=AD?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=EF=BC=8C=E7=AE=A1=E7=90=86=E5=91=98=E6=8B=92?= =?UTF-8?q?=E7=BB=9D=E9=80=80=E6=AC=BE=E4=B8=8D=E5=86=8D500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- users/tixian_shenhe_services.py | 3 ++- users/views/kefu_orders.py | 31 +++++++++++++++++-------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/users/tixian_shenhe_services.py b/users/tixian_shenhe_services.py index c92a681..09ac8ce 100644 --- a/users/tixian_shenhe_services.py +++ b/users/tixian_shenhe_services.py @@ -69,6 +69,7 @@ ORDER_STATUS_REFUNDED = 5 DASHOU_WITHDRAW_APPLY_NON_BLOCKING_ORDER_STATUSES = ( 1, # 待抢单 3, # 已完成 + 4, # 退款审核中 5, # 已退款 6, # 退款失败 7, # 指定中 @@ -285,7 +286,7 @@ def _dashou_has_unfinished_orders(yonghuid): def _dashou_has_orders_blocking_withdraw_apply(yonghuid): - """打手提现申请专用:仅拦进行中(2)、退款审核中(4)等与该用户关联的订单。""" + """打手提现申请专用:仅拦进行中(2)等与该用户关联的订单。""" return Order.query.filter( PlayerID=yonghuid, ).exclude( diff --git a/users/views/kefu_orders.py b/users/views/kefu_orders.py index 6b2feb6..30f0fc2 100644 --- a/users/views/kefu_orders.py +++ b/users/views/kefu_orders.py @@ -822,11 +822,12 @@ class KefuPlatformRefundView(APIView): except Exception as e: logger.error(f"平台退款更新退款记录异常: {str(e)}", exc_info=True) - # 11. 更新客服统计数据 - kefu.jinrichuli += 1 - kefu.jinyuechuli += 1 - kefu.zongchuli += 1 - kefu.save() + # 11. 更新客服统计数据(管理员无客服扩展表,跳过) + if kefu is not None: + kefu.jinrichuli += 1 + kefu.jinyuechuli += 1 + kefu.zongchuli += 1 + kefu.save() # 🔥 新增:调用打手每日统计(成交) try: @@ -1082,11 +1083,12 @@ class KefuRejectRefundView(APIView): logger.error(f"打手每日统计更新失败: {e}") # 不影响主流程 - # 10. 更新客服统计数据 - kefu.jinrichuli += 1 - kefu.jinyuechuli += 1 - kefu.zongchuli += 1 - kefu.save() + # 10. 更新客服统计数据(管理员无客服扩展表,跳过) + if kefu is not None: + kefu.jinrichuli += 1 + kefu.jinyuechuli += 1 + kefu.zongchuli += 1 + kefu.save() return Response({'code': 0, 'msg': '拒绝退款成功'}) @@ -1352,10 +1354,11 @@ class KefuRejectSettlementView(APIView): - kefu.jinrichuli += 1 - kefu.jinyuechuli += 1 - kefu.zongchuli += 1 - kefu.save() + if kefu is not None: + kefu.jinrichuli += 1 + kefu.jinyuechuli += 1 + kefu.zongchuli += 1 + kefu.save() return Response({'code': 0, 'msg': '拒绝结算成功'})