fix: 严格校验体验会员不可提现,抢单按会员类型匹配
展示层 clumber 与提现/抢单权限分离:佣金提现须正式会员并双重拦截体验期;抢单走 resolve_order_membership_ids + 总会员包含判断。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -317,7 +317,10 @@ def _build_clumber_from_paid_czjilu(yonghu_id):
|
||||
|
||||
|
||||
def ensure_grab_pool_clumber(yonghu_id):
|
||||
"""抢单池:同步权益 + huiyuangoumai + 已付充值单兜底,体验会员按正式返回。"""
|
||||
"""
|
||||
【仅抢单池展示】同步权益并构造 clumber,供老小程序识别会员。
|
||||
不得用于提现/收款等权限校验;提现须走 check_dashou_has_formal_huiyuan_for_withdraw。
|
||||
"""
|
||||
from jituan.services.member_recharge import sync_member_entitlements_for_user
|
||||
|
||||
sync_member_entitlements_for_user(yonghu_id)
|
||||
|
||||
@@ -900,14 +900,62 @@ def confirm_member_recharge_paid(dingdan_id, yonghuid):
|
||||
|
||||
|
||||
def dashou_in_active_trial_period(yonghuid):
|
||||
"""打手是否处于未过期的体验会员期(限制佣金提现)。"""
|
||||
"""打手是否处于未过期的体验会员期(禁止佣金提现;与抢单池展示逻辑无关)。"""
|
||||
from jituan.services.huiyuan_bundle import huiyuan_ids_match
|
||||
|
||||
now = timezone.now()
|
||||
return Huiyuangoumai.query.filter(
|
||||
yonghu_id=yonghuid,
|
||||
is_trial=True,
|
||||
huiyuan_zhuangtai=1,
|
||||
daoqi_time__gt=now,
|
||||
).exists()
|
||||
for rec in Huiyuangoumai.query.filter(yonghu_id=yonghuid):
|
||||
if rec.jiance_shifou_daoqi():
|
||||
continue
|
||||
if rec.huiyuan_zhuangtai != 1:
|
||||
continue
|
||||
if rec.is_trial:
|
||||
return True
|
||||
|
||||
for order in Czjilu.query.filter(
|
||||
yonghuid=yonghuid,
|
||||
leixing=MEMBER_LEIXING,
|
||||
zhuangtai=MEMBER_PAID_STATUS,
|
||||
).order_by('-CreateTime')[:30]:
|
||||
cid = getattr(order, 'club_id', None) or CLUB_ID_DEFAULT
|
||||
if not _order_is_trial_like(order, cid):
|
||||
continue
|
||||
hid = order.huiyuan_id
|
||||
if not hid:
|
||||
continue
|
||||
has_formal = False
|
||||
for rec in Huiyuangoumai.query.filter(yonghu_id=yonghuid):
|
||||
if rec.is_trial:
|
||||
continue
|
||||
if (
|
||||
huiyuan_ids_match(rec.huiyuan_id, hid)
|
||||
and not rec.jiance_shifou_daoqi()
|
||||
and rec.huiyuan_zhuangtai == 1
|
||||
):
|
||||
has_formal = True
|
||||
break
|
||||
if has_formal:
|
||||
continue
|
||||
days = int(getattr(order, 'purchase_days', None) or 0)
|
||||
if days <= 0:
|
||||
_, _, days = club_huiyuan_sellable(cid, hid, is_trial=True)
|
||||
days = max(days, 1)
|
||||
start = order.CreateTime or now
|
||||
if timezone.is_naive(start):
|
||||
start = timezone.make_aware(start, timezone.get_current_timezone())
|
||||
if start + timedelta(days=days) > now:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def dashou_has_active_formal_huiyuan(yonghuid):
|
||||
"""打手是否持有未过期的正式会员(非体验)。"""
|
||||
for rec in Huiyuangoumai.query.filter(yonghu_id=yonghuid):
|
||||
if rec.is_trial:
|
||||
continue
|
||||
if not rec.jiance_shifou_daoqi() and rec.huiyuan_zhuangtai == 1:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def extend_member_entitlement_admin(yonghuid, huiyuan_id, days, club_id=None, operator_note=''):
|
||||
|
||||
Reference in New Issue
Block a user