diff --git a/jituan/services/gift_huiyuan.py b/jituan/services/gift_huiyuan.py index 3f7f07e..81206b1 100644 --- a/jituan/services/gift_huiyuan.py +++ b/jituan/services/gift_huiyuan.py @@ -27,6 +27,17 @@ def _gift_record_active(record, now=None): return daoqi > now +def user_has_any_active_gift_huiyuan(yonghu_id): + """是否持有任意一条未过期的赠送会员(提现/收款资格用)。""" + if not yonghu_id: + return False + now = timezone.now() + for rec in DashouZengsongHuiyuan.query.filter(yonghu_id=yonghu_id): + if _gift_record_active(rec, now=now): + return True + return False + + def parse_gift_daoqi_time(raw): """ 解析到期时间。 diff --git a/users/tixian_shenhe_services.py b/users/tixian_shenhe_services.py index bdde411..dcb66dc 100644 --- a/users/tixian_shenhe_services.py +++ b/users/tixian_shenhe_services.py @@ -240,16 +240,19 @@ def check_dashou_has_valid_huiyuan(yonghuid): 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, ) + from jituan.services.gift_huiyuan import user_has_any_active_gift_huiyuan if dashou_has_active_formal_huiyuan(yonghuid): return True, '' + if user_has_any_active_gift_huiyuan(yonghuid): + return True, '' if dashou_in_active_trial_period(yonghuid): return False, '体验会员不可提现佣金,请购买正式会员' if not Huiyuangoumai.query.filter(yonghu_id=yonghuid).exists():