feat: 提现自动过审开关(申请通过校验后直接待收款)

This commit is contained in:
XingQue
2026-08-01 19:17:40 +08:00
parent cc32158911
commit 5a8029e30c
4 changed files with 58 additions and 7 deletions

View File

@@ -129,6 +129,15 @@ def get_withdraw_mode(club_id):
return 2
def get_auto_pass_audit(club_id):
"""自动过审True 时 zddksh 申请通过校验后直接落待收款(6)。默认 False。"""
club_id = _normalize_club_id(club_id)
try:
return bool(ClubWithdrawConfig.query.get(club_id=club_id).auto_pass_audit)
except ClubWithdrawConfig.DoesNotExist:
return False
def get_personal_daily_quota(club_id, leixing, profile):
"""打手/管事/组长个人每日限额:用户额外限额优先,否则读俱乐部配置。"""
if leixing == 1:
@@ -217,6 +226,7 @@ def build_withdraw_settings_payload(request):
'club_id': club_id,
'scope': resolve_club_scope(request),
'withdraw_mode': get_withdraw_mode(club_id),
'auto_pass_audit': get_auto_pass_audit(club_id),
'rates': rate_map,
'order_rates': order_rate_map,
'penalty_bonus_rates': get_penalty_bonus_rates_map(club_id),
@@ -318,15 +328,31 @@ def apply_withdraw_settings_update(request, permissions):
_set_quota(club_id, total_code_map[role], Decimal(str(val)))
withdraw_mode = request.data.get('withdraw_mode')
if withdraw_mode is not None:
auto_pass_audit = request.data.get('auto_pass_audit')
if withdraw_mode is not None or auto_pass_audit is not None:
if not any(p in permissions for p in ('5500a', '5500b', '5500c')):
return Response({'code': 403, 'msg': '无权限修改提现模式'})
defaults = {}
if withdraw_mode is not None:
defaults['mode'] = int(withdraw_mode)
if auto_pass_audit is not None:
defaults['auto_pass_audit'] = bool(
auto_pass_audit in (True, 1, '1', 'true', 'True')
)
row, created = ClubWithdrawConfig.query.get_or_create(
club_id=club_id,
defaults={'mode': int(withdraw_mode)},
defaults=defaults or {'mode': 2, 'auto_pass_audit': False},
)
if not created:
row.mode = int(withdraw_mode)
row.save(update_fields=['mode', 'UpdateTime'])
update_fields = ['UpdateTime']
if withdraw_mode is not None:
row.mode = int(withdraw_mode)
update_fields.append('mode')
if auto_pass_audit is not None:
row.auto_pass_audit = bool(
auto_pass_audit in (True, 1, '1', 'true', 'True')
)
update_fields.append('auto_pass_audit')
row.save(update_fields=update_fields)
return Response({'code': 0, 'msg': '设置修改成功'})