From af2578573c26fe8a82a49e464da793a15e0e1774 Mon Sep 17 00:00:00 2001 From: XingQue Date: Fri, 26 Jun 2026 02:36:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=93=E9=AA=8C=E4=BC=9A=E5=91=98=E6=8B=A6?= =?UTF-8?q?=E6=88=AA=E5=AE=A1=E6=A0=B8=E6=8F=90=E7=8E=B0=E4=B8=8E=E6=94=B6?= =?UTF-8?q?=E6=AC=BE=EF=BC=9B=E4=BF=AE=E5=A4=8D=E5=88=86=E7=BA=A20?= =?UTF-8?q?=E5=85=83=E4=BB=8D=E8=B5=B0=E6=B0=B8=E4=B9=85=E5=88=86=E7=BA=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jituan/services/member_recharge.py | 17 +++++++++++------ users/tixian_shenhe_services.py | 19 +++++++++++++++++++ users/views.py | 7 ++++--- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/jituan/services/member_recharge.py b/jituan/services/member_recharge.py index a138791..06ff134 100644 --- a/jituan/services/member_recharge.py +++ b/jituan/services/member_recharge.py @@ -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') diff --git a/users/tixian_shenhe_services.py b/users/tixian_shenhe_services.py index 7bdbccb..575ad2e 100644 --- a/users/tixian_shenhe_services.py +++ b/users/tixian_shenhe_services.py @@ -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: diff --git a/users/views.py b/users/views.py index 049cd34..9163118 100644 --- a/users/views.py +++ b/users/views.py @@ -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 ''}}