feat: 提现自动过审开关(申请通过校验后直接待收款)
This commit is contained in:
18
jituan/migrations/0024_club_withdraw_auto_pass_audit.py
Normal file
18
jituan/migrations/0024_club_withdraw_auto_pass_audit.py
Normal 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='自动过审'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -290,6 +290,8 @@ class ClubLilubiao(QModel):
|
|||||||
class ClubWithdrawConfig(QModel):
|
class ClubWithdrawConfig(QModel):
|
||||||
club_id = models.CharField(max_length=16, primary_key=True)
|
club_id = models.CharField(max_length=16, primary_key=True)
|
||||||
mode = models.IntegerField(default=1, verbose_name='1自动2手动')
|
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)
|
CreateTime = models.DateTimeField(auto_now_add=True)
|
||||||
UpdateTime = models.DateTimeField(auto_now=True)
|
UpdateTime = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
|||||||
@@ -129,6 +129,15 @@ def get_withdraw_mode(club_id):
|
|||||||
return 2
|
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):
|
def get_personal_daily_quota(club_id, leixing, profile):
|
||||||
"""打手/管事/组长个人每日限额:用户额外限额优先,否则读俱乐部配置。"""
|
"""打手/管事/组长个人每日限额:用户额外限额优先,否则读俱乐部配置。"""
|
||||||
if leixing == 1:
|
if leixing == 1:
|
||||||
@@ -217,6 +226,7 @@ def build_withdraw_settings_payload(request):
|
|||||||
'club_id': club_id,
|
'club_id': club_id,
|
||||||
'scope': resolve_club_scope(request),
|
'scope': resolve_club_scope(request),
|
||||||
'withdraw_mode': get_withdraw_mode(club_id),
|
'withdraw_mode': get_withdraw_mode(club_id),
|
||||||
|
'auto_pass_audit': get_auto_pass_audit(club_id),
|
||||||
'rates': rate_map,
|
'rates': rate_map,
|
||||||
'order_rates': order_rate_map,
|
'order_rates': order_rate_map,
|
||||||
'penalty_bonus_rates': get_penalty_bonus_rates_map(club_id),
|
'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)))
|
_set_quota(club_id, total_code_map[role], Decimal(str(val)))
|
||||||
|
|
||||||
withdraw_mode = request.data.get('withdraw_mode')
|
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')):
|
if not any(p in permissions for p in ('5500a', '5500b', '5500c')):
|
||||||
return Response({'code': 403, 'msg': '无权限修改提现模式'})
|
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(
|
row, created = ClubWithdrawConfig.query.get_or_create(
|
||||||
club_id=club_id,
|
club_id=club_id,
|
||||||
defaults={'mode': int(withdraw_mode)},
|
defaults=defaults or {'mode': 2, 'auto_pass_audit': False},
|
||||||
)
|
)
|
||||||
if not created:
|
if not created:
|
||||||
row.mode = int(withdraw_mode)
|
update_fields = ['UpdateTime']
|
||||||
row.save(update_fields=['mode', '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': '设置修改成功'})
|
return Response({'code': 0, 'msg': '设置修改成功'})
|
||||||
|
|||||||
@@ -1758,12 +1758,16 @@ def create_audit_application(user_main, leixing, jine):
|
|||||||
nicheng = deduct_balance(user_main, leixing, jine) or nicheng
|
nicheng = deduct_balance(user_main, leixing, jine) or nicheng
|
||||||
club_id = club_id_for_tixian_yonghuid(yonghuid)
|
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 = {
|
audit_kwargs = {
|
||||||
'shenhe_danhao': shenhe_danhao,
|
'shenhe_danhao': shenhe_danhao,
|
||||||
'club_id': club_id,
|
'club_id': club_id,
|
||||||
'yonghuid': yonghuid,
|
'yonghuid': yonghuid,
|
||||||
'leixing': leixing,
|
'leixing': leixing,
|
||||||
'zhuangtai': 1,
|
'zhuangtai': init_status,
|
||||||
'shenqing_jine': jine,
|
'shenqing_jine': jine,
|
||||||
'shouxufei': shouxufei,
|
'shouxufei': shouxufei,
|
||||||
'shijidaozhang': shijidaozhang,
|
'shijidaozhang': shijidaozhang,
|
||||||
@@ -1783,7 +1787,7 @@ def create_audit_application(user_main, leixing, jine):
|
|||||||
zhifu=user_main.PaymentQRCode or '',
|
zhifu=user_main.PaymentQRCode or '',
|
||||||
skzhanghao=user_main.PaymentAccount or '',
|
skzhanghao=user_main.PaymentAccount or '',
|
||||||
jine=shijidaozhang,
|
jine=shijidaozhang,
|
||||||
zhuangtai=1,
|
zhuangtai=init_status,
|
||||||
fangshi=1,
|
fangshi=1,
|
||||||
shenheid=None,
|
shenheid=None,
|
||||||
bhliyou='',
|
bhliyou='',
|
||||||
@@ -1803,6 +1807,7 @@ def create_audit_application(user_main, leixing, jine):
|
|||||||
'shijidaozhang': str(shijidaozhang),
|
'shijidaozhang': str(shijidaozhang),
|
||||||
'current_rate': str(feilv.quantize(decimal.Decimal('0.0001'))),
|
'current_rate': str(feilv.quantize(decimal.Decimal('0.0001'))),
|
||||||
'leixing': leixing,
|
'leixing': leixing,
|
||||||
'zhuangtai': 1,
|
'zhuangtai': init_status,
|
||||||
|
'auto_pass_audit': init_status == 6,
|
||||||
})
|
})
|
||||||
return response_data
|
return response_data
|
||||||
|
|||||||
Reference in New Issue
Block a user