fix: 严格校验体验会员不可提现,抢单按会员类型匹配

展示层 clumber 与提现/抢单权限分离:佣金提现须正式会员并双重拦截体验期;抢单走 resolve_order_membership_ids + 总会员包含判断。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-08 14:26:16 +08:00
parent abfe497ddc
commit b54904a9f2
5 changed files with 106 additions and 22 deletions

View File

@@ -178,13 +178,13 @@ def calc_fee_amounts(jine, feilv):
def check_dashou_has_valid_huiyuan(yonghuid):
"""
打手至少持有一个未过期会员(Huiyuangoumai + jiance_shifou_daoqi 同步状态
打手至少持有一个未过期会员(含体验,用于接单等场景
返回 (True, '') 或 (False, 原因)
"""
records = Huiyuangoumai.query.filter(yonghu_id=yonghuid)
if not records.exists():
return False, '您暂无会员记录,无法提现'
return False, '您暂无会员记录,无法操作'
for record in records:
is_expired = record.jiance_shifou_daoqi()
@@ -193,8 +193,27 @@ def check_dashou_has_valid_huiyuan(yonghuid):
return False, '您的会员已全部过期,请先续费后再操作'
def check_dashou_has_formal_huiyuan_for_withdraw(yonghuid):
"""
打手佣金提现/收款:必须持有未过期的正式会员。
体验会员期内一律拒绝;体验到期后须购买正式会员。
"""
from jituan.services.member_recharge import (
dashou_has_active_formal_huiyuan,
dashou_in_active_trial_period,
)
if dashou_has_active_formal_huiyuan(yonghuid):
return True, ''
if dashou_in_active_trial_period(yonghuid):
return False, '体验会员不可提现佣金,请购买正式会员'
if not Huiyuangoumai.query.filter(yonghu_id=yonghuid).exists():
return False, '您暂无会员记录,无法提现'
return False, '您的会员已全部过期,请购买正式会员后提现'
TRIAL_COMMISSION_WITHDRAW_MSG = (
'体验会员期间不可提现佣金,请升级正式会员或待体验到期'
'体验会员不可提现佣金,请购买正式会员'
)
@@ -228,7 +247,7 @@ def validate_withdraw_eligibility(user_main, leixing, jine):
return False, '有订单进行中,请完成后提现', {}
if dashou.jifen != 10:
return False, '积分不足10分请补充积分后提现', {}
huiyuan_ok, huiyuan_msg = check_dashou_has_valid_huiyuan(yonghuid)
huiyuan_ok, huiyuan_msg = check_dashou_has_formal_huiyuan_for_withdraw(yonghuid)
if not huiyuan_ok:
return False, huiyuan_msg, {}
trial_ok, trial_msg = check_dashou_trial_blocks_commission_withdraw(yonghuid)
@@ -357,7 +376,7 @@ def validate_collect_eligibility(user_main, leixing):
return False, '您有订单进行中,请完成后再收款'
if dashou.jifen != 10:
return False, '积分不足10分无法收款'
huiyuan_ok, huiyuan_msg = check_dashou_has_valid_huiyuan(yonghuid)
huiyuan_ok, huiyuan_msg = check_dashou_has_formal_huiyuan_for_withdraw(yonghuid)
if not huiyuan_ok:
return False, huiyuan_msg
trial_ok, trial_msg = check_dashou_trial_blocks_commission_withdraw(yonghuid)