体验会员拦截审核提现与收款;修复分红0元仍走永久分红
This commit is contained in:
@@ -207,6 +207,7 @@ def fulfill_member_balance_purchase(czjilu, huiyuan, club_id=None):
|
||||
|
||||
|
||||
def _lookup_duoci_fenhong(club_id, huiyuan_id, beneficiary_id, cishu, field):
|
||||
"""返回 (金额, 是否已配置行)。已配置为 0 时不应再回落到永久分红。"""
|
||||
try:
|
||||
row = DuociFenhong.query.get(
|
||||
club_id=club_id or CLUB_ID_DEFAULT,
|
||||
@@ -214,15 +215,17 @@ def _lookup_duoci_fenhong(club_id, huiyuan_id, beneficiary_id, cishu, field):
|
||||
yonghuid=beneficiary_id,
|
||||
cishu=cishu,
|
||||
)
|
||||
return Decimal(str(getattr(row, field) or 0))
|
||||
return Decimal(str(getattr(row, field) or 0)), True
|
||||
except DuociFenhong.DoesNotExist:
|
||||
return None
|
||||
return None, False
|
||||
|
||||
|
||||
def calc_guanshi_member_fenhong(huiyuan_id, guanshi_id, cishu, club_id, default_guanshi_fc):
|
||||
club_id = club_id or CLUB_ID_DEFAULT
|
||||
custom = _lookup_duoci_fenhong(club_id, huiyuan_id, guanshi_id, cishu, 'guanshi_fenhong')
|
||||
if custom is not None:
|
||||
custom, configured = _lookup_duoci_fenhong(
|
||||
club_id, huiyuan_id, guanshi_id, cishu, 'guanshi_fenhong',
|
||||
)
|
||||
if configured:
|
||||
return custom if custom > 0 else None
|
||||
if cishu == 1:
|
||||
base = default_guanshi_fc if default_guanshi_fc is not None else Decimal('0')
|
||||
@@ -242,8 +245,10 @@ def calc_zuzhang_member_fenhong(huiyuan_id, zuzhang_id, cishu, club_id, default_
|
||||
if not zuzhang_id:
|
||||
return None
|
||||
club_id = club_id or CLUB_ID_DEFAULT
|
||||
custom = _lookup_duoci_fenhong(club_id, huiyuan_id, zuzhang_id, cishu, 'zuzhang_fenhong')
|
||||
if custom is not None:
|
||||
custom, configured = _lookup_duoci_fenhong(
|
||||
club_id, huiyuan_id, zuzhang_id, cishu, 'zuzhang_fenhong',
|
||||
)
|
||||
if configured:
|
||||
return custom if custom > 0 else None
|
||||
if cishu == 1:
|
||||
base = default_zuzhang_fc if default_zuzhang_fc is not None else Decimal('0')
|
||||
|
||||
@@ -193,6 +193,19 @@ def check_dashou_has_valid_huiyuan(yonghuid):
|
||||
return False, '您的会员已全部过期,请先续费后再操作'
|
||||
|
||||
|
||||
TRIAL_COMMISSION_WITHDRAW_MSG = (
|
||||
'体验会员期间不可提现佣金,请升级正式会员或待体验到期'
|
||||
)
|
||||
|
||||
|
||||
def check_dashou_trial_blocks_commission_withdraw(yonghuid):
|
||||
"""打手佣金提现/收款:体验会员期内禁止。"""
|
||||
from jituan.services.member_recharge import dashou_in_active_trial_period
|
||||
if dashou_in_active_trial_period(yonghuid):
|
||||
return False, TRIAL_COMMISSION_WITHDRAW_MSG
|
||||
return True, ''
|
||||
|
||||
|
||||
def validate_withdraw_eligibility(user_main, leixing, jine):
|
||||
"""
|
||||
提现申请资格校验(完整基本条件;仅放宽「不限制并行申请笔数」)。
|
||||
@@ -218,6 +231,9 @@ def validate_withdraw_eligibility(user_main, leixing, jine):
|
||||
huiyuan_ok, huiyuan_msg = check_dashou_has_valid_huiyuan(yonghuid)
|
||||
if not huiyuan_ok:
|
||||
return False, huiyuan_msg, {}
|
||||
trial_ok, trial_msg = check_dashou_trial_blocks_commission_withdraw(yonghuid)
|
||||
if not trial_ok:
|
||||
return False, trial_msg, {}
|
||||
if dashou.yue < jine:
|
||||
return False, f'余额不足,当前余额: {dashou.yue}', {}
|
||||
return True, '', {'nicheng': dashou.nicheng or ''}
|
||||
@@ -344,6 +360,9 @@ def validate_collect_eligibility(user_main, leixing):
|
||||
huiyuan_ok, huiyuan_msg = check_dashou_has_valid_huiyuan(yonghuid)
|
||||
if not huiyuan_ok:
|
||||
return False, huiyuan_msg
|
||||
trial_ok, trial_msg = check_dashou_trial_blocks_commission_withdraw(yonghuid)
|
||||
if not trial_ok:
|
||||
return False, trial_msg
|
||||
return True, ''
|
||||
|
||||
if leixing == 5:
|
||||
|
||||
@@ -70,6 +70,7 @@ from .tixian_shenhe_services import (
|
||||
mark_transfer_success, release_collect_quota_for_record,
|
||||
close_audit_wechat_failed, query_wechat_transfer_bill,
|
||||
check_shijidaozhang_within_limit,
|
||||
check_dashou_trial_blocks_commission_withdraw,
|
||||
WX_STATE_FAIL, WX_STATE_SUCCESS, WX_STATE_WAIT, WX_STATE_CANCELING,
|
||||
)
|
||||
from .tixian_shenhe_views import process_audit_collect
|
||||
@@ -2025,9 +2026,9 @@ class TixianShenqingView(APIView):
|
||||
if dashou.yue < jine:
|
||||
return {'code': 13, 'msg': f'余额不足,当前余额: {dashou.yue}'}
|
||||
|
||||
from jituan.services.member_recharge import dashou_in_active_trial_period
|
||||
if dashou_in_active_trial_period(user_main.UserUID):
|
||||
return {'code': 16, 'msg': '体验会员期间不可提现佣金,请升级正式会员或待体验到期'}
|
||||
trial_ok, trial_msg = check_dashou_trial_blocks_commission_withdraw(user_main.UserUID)
|
||||
if not trial_ok:
|
||||
return {'code': 16, 'msg': trial_msg}
|
||||
|
||||
return {'code': 0, 'msg': 'ok', 'data': {'nicheng': dashou.nicheng or ''}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user