体验会员拦截审核提现与收款;修复分红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')
|
||||
|
||||
Reference in New Issue
Block a user