feat: 提现自动过审按身份勾选(打手/管事/组长等)

This commit is contained in:
XingQue
2026-08-01 20:55:41 +08:00
parent 5a8029e30c
commit 6f635659eb
4 changed files with 104 additions and 22 deletions

View File

@@ -0,0 +1,42 @@
# 自动过审由「总开关」改为「按提现身份勾选」
from django.db import migrations, models
def forwards_bool_to_leixings(apps, schema_editor):
ClubWithdrawConfig = apps.get_model('jituan', 'ClubWithdrawConfig')
# 若旧开关已开:默认放开全部身份,避免线上行为突然变严
all_leixings = [1, 2, 3, 4, 5, 6]
for row in ClubWithdrawConfig.objects.all():
if getattr(row, 'auto_pass_audit', False):
row.auto_pass_leixings = list(all_leixings)
else:
row.auto_pass_leixings = []
row.save(update_fields=['auto_pass_leixings'])
def backwards_leixings_to_bool(apps, schema_editor):
ClubWithdrawConfig = apps.get_model('jituan', 'ClubWithdrawConfig')
for row in ClubWithdrawConfig.objects.all():
row.auto_pass_audit = bool(row.auto_pass_leixings)
row.save(update_fields=['auto_pass_audit'])
class Migration(migrations.Migration):
dependencies = [
('jituan', '0024_club_withdraw_auto_pass_audit'),
]
operations = [
migrations.AddField(
model_name='clubwithdrawconfig',
name='auto_pass_leixings',
field=models.JSONField(blank=True, default=list, verbose_name='自动过审身份'),
),
migrations.RunPython(forwards_bool_to_leixings, backwards_leixings_to_bool),
migrations.RemoveField(
model_name='clubwithdrawconfig',
name='auto_pass_audit',
),
]