From dc6ddee0d7084f3ee6d30c9e9328738d732ba1bc Mon Sep 17 00:00:00 2001 From: XingQue Date: Fri, 10 Jul 2026 23:49:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=89=93=E6=89=8B=E6=8F=90=E7=8E=B0?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E4=BB=85=E6=8B=A6=E6=88=AA=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E4=B8=AD=E4=B8=8E=E9=80=80=E6=AC=BE=E5=AE=A1=E6=A0=B8=E4=B8=AD?= =?UTF-8?q?=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- users/tixian_shenhe_services.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/users/tixian_shenhe_services.py b/users/tixian_shenhe_services.py index 7aff445..c92a681 100644 --- a/users/tixian_shenhe_services.py +++ b/users/tixian_shenhe_services.py @@ -65,6 +65,16 @@ logger = logging.getLogger('yonghu.tixian_shenhe') ORDER_STATUS_COMPLETED = 3 ORDER_STATUS_REFUNDED = 5 +# 打手提现申请:以下状态不拦截(仅 jiedan_dashou_id=该用户 的订单) +DASHOU_WITHDRAW_APPLY_NON_BLOCKING_ORDER_STATUSES = ( + 1, # 待抢单 + 3, # 已完成 + 5, # 已退款 + 6, # 退款失败 + 7, # 指定中 + 8, # 结算中 +) + LEIXING_RATE_KEY = { 1: '5', 2: '6', @@ -274,6 +284,15 @@ def _dashou_has_unfinished_orders(yonghuid): ).exists() +def _dashou_has_orders_blocking_withdraw_apply(yonghuid): + """打手提现申请专用:仅拦进行中(2)、退款审核中(4)等与该用户关联的订单。""" + return Order.query.filter( + PlayerID=yonghuid, + ).exclude( + Status__in=DASHOU_WITHDRAW_APPLY_NON_BLOCKING_ORDER_STATUSES, + ).exists() + + def _dashou_has_open_penalties(yonghuid): return Penalty.query.filter( PenalizedUserID=yonghuid, @@ -339,7 +358,7 @@ def validate_withdraw_eligibility(user_main, leixing, jine): trial_ok, trial_msg = check_dashou_trial_blocks_commission_withdraw(yonghuid) if not trial_ok: return False, trial_msg, {} - if _dashou_has_unfinished_orders(yonghuid): + if _dashou_has_orders_blocking_withdraw_apply(yonghuid): return False, '您还有未完成或未退款的订单,请先处理完毕再提现', {} if _dashou_has_open_penalties(yonghuid): return False, '您有未处理完毕的自身罚单(待缴纳/申诉中),请先处理', {} @@ -396,7 +415,7 @@ def validate_withdraw_eligibility(user_main, leixing, jine): return False, huiyuan_msg, {} if dashou.yajin < jine: return False, f'押金余额不足,当前押金: {dashou.yajin}', {} - if _dashou_has_unfinished_orders(yonghuid): + if _dashou_has_orders_blocking_withdraw_apply(yonghuid): return False, '您还有未完成或未退款的订单,请先处理完毕再提取押金', {} if _dashou_has_open_penalties(yonghuid): return False, '您有未处理完毕的自身罚单(待缴纳/申诉中),请先处理', {}