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

@@ -0,0 +1,18 @@
# Generated manually for withdraw auto-pass audit switch
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('jituan', '0023_club_leixing_show_price'),
]
operations = [
migrations.AddField(
model_name='clubwithdrawconfig',
name='auto_pass_audit',
field=models.BooleanField(default=False, verbose_name='自动过审'),
),
]

View File

@@ -290,6 +290,8 @@ class ClubLilubiao(QModel):
class ClubWithdrawConfig(QModel):
club_id = models.CharField(max_length=16, primary_key=True)
mode = models.IntegerField(default=1, verbose_name='1自动2手动')
# True=自动提现申请后直接待收款(6),跳过人工审;校验逻辑不变
auto_pass_audit = models.BooleanField(default=False, verbose_name='自动过审')
CreateTime = models.DateTimeField(auto_now_add=True)
UpdateTime = models.DateTimeField(auto_now=True)

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': '设置修改成功'})

View File

@@ -1758,12 +1758,16 @@ def create_audit_application(user_main, leixing, jine):
nicheng = deduct_balance(user_main, leixing, jine) or nicheng
club_id = club_id_for_tixian_yonghuid(yonghuid)
# 自动过审:校验已全部通过后,直接落待收款(6);默认仍为审核中(1)。不改任何校验。
from jituan.services.withdraw_config import get_auto_pass_audit
init_status = 6 if get_auto_pass_audit(club_id) else 1
audit_kwargs = {
'shenhe_danhao': shenhe_danhao,
'club_id': club_id,
'yonghuid': yonghuid,
'leixing': leixing,
'zhuangtai': 1,
'zhuangtai': init_status,
'shenqing_jine': jine,
'shouxufei': shouxufei,
'shijidaozhang': shijidaozhang,
@@ -1783,7 +1787,7 @@ def create_audit_application(user_main, leixing, jine):
zhifu=user_main.PaymentQRCode or '',
skzhanghao=user_main.PaymentAccount or '',
jine=shijidaozhang,
zhuangtai=1,
zhuangtai=init_status,
fangshi=1,
shenheid=None,
bhliyou='',
@@ -1803,6 +1807,7 @@ def create_audit_application(user_main, leixing, jine):
'shijidaozhang': str(shijidaozhang),
'current_rate': str(feilv.quantize(decimal.Decimal('0.0001'))),
'leixing': leixing,
'zhuangtai': 1,
'zhuangtai': init_status,
'auto_pass_audit': init_status == 6,
})
return response_data