From 5a8029e30c863b3d1b4c777616b3b651a687e078 Mon Sep 17 00:00:00 2001 From: XingQue Date: Sat, 1 Aug 2026 19:17:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8F=90=E7=8E=B0=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=BF=87=E5=AE=A1=E5=BC=80=E5=85=B3=EF=BC=88=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E6=A0=A1=E9=AA=8C=E5=90=8E=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E5=BE=85=E6=94=B6=E6=AC=BE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0024_club_withdraw_auto_pass_audit.py | 18 ++++++++++ jituan/models.py | 2 ++ jituan/services/withdraw_config.py | 34 ++++++++++++++++--- users/tixian_shenhe_services.py | 11 ++++-- 4 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 jituan/migrations/0024_club_withdraw_auto_pass_audit.py diff --git a/jituan/migrations/0024_club_withdraw_auto_pass_audit.py b/jituan/migrations/0024_club_withdraw_auto_pass_audit.py new file mode 100644 index 0000000..a1f7aac --- /dev/null +++ b/jituan/migrations/0024_club_withdraw_auto_pass_audit.py @@ -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='自动过审'), + ), + ] diff --git a/jituan/models.py b/jituan/models.py index 0b7716d..a6beac0 100644 --- a/jituan/models.py +++ b/jituan/models.py @@ -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) diff --git a/jituan/services/withdraw_config.py b/jituan/services/withdraw_config.py index ff45c8c..78faa10 100644 --- a/jituan/services/withdraw_config.py +++ b/jituan/services/withdraw_config.py @@ -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': '设置修改成功'}) diff --git a/users/tixian_shenhe_services.py b/users/tixian_shenhe_services.py index 47723db..0136b55 100644 --- a/users/tixian_shenhe_services.py +++ b/users/tixian_shenhe_services.py @@ -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