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, '您有未处理完毕的自身罚单(待缴纳/申诉中),请先处理', {}