修复了跟自动提现有关的所有接口,增加了更多的校验条件,比如会员是否到期,每日限额校验,每日限额校验全部改到收款接口里,商家派单接口,减少了校验条件 ,比如前端没有传递会员ID或抢单要求类型的,一样可以派,每日限额表模型提现表,模型类型字段添加了几个数字,相当于添加了几种利率,管事押金以及订单分红利率 ,后台获取以及更改提现手续费的接口增加了几个利率的修改,商家结算接口,还有客服强制结算接口,增加了管事订单分红

This commit is contained in:
XingQue
2026-06-12 21:42:09 +08:00
parent 25d6ec70f3
commit 2446f2c912
5 changed files with 45 additions and 34 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -3012,7 +3012,7 @@ class ShangjiaPaifaView(APIView):
commission_value_str = str(commission_value_raw).strip() if commission_value_raw is not None else ''
# ----- 3. 必填校验 -----
if not all([shangpin_type_id, huiyuan_id, dingdan_jieshao, laoban_name, jiage_str]):
if not all([shangpin_type_id, dingdan_jieshao, laoban_name, jiage_str]):
logger.warning(f"参数缺失: {request.data}")
return Response({'code': 400, 'msg': '缺少必填参数'})

View File

@@ -254,7 +254,8 @@ class TixianRiTongji(models.Model):
"""
riqi = models.DateField(db_index=True, verbose_name='日期')
leixing = models.IntegerField(
choices=[(1, '打手'), (2, '管事'), (3, '组长')],
choices=[(1, '打手'), (2, '管事'), (3, '组长'),
(4, '考核官'), (5, '打手押金'), (6, '商家余额')],
verbose_name='用户类型'
)
total_amount = models.DecimalField(max_digits=12, decimal_places=2, default=0.00, verbose_name='当天提现总额(元)')

View File

@@ -6766,9 +6766,6 @@ class UpdateGuanliView(APIView):
class GetWithdrawSettingsView(APIView):
"""
获取提现设置(手续费利率、每日限额、当日已提现总额)
@@ -6808,18 +6805,19 @@ class GetWithdrawSettingsView(APIView):
obj = TixianQuotaDefault.objects.filter(leixing=leixing).first()
quota_map[leixing] = float(obj.default_quota) if obj else 20.0
# 3. 每日总限额 (leixing=4,5,6)
# 3. 每日总限额提现类型1~6 → 配置表4~9
total_limit_map = {}
for leixing, total_code in [(1, 4), (2, 5), (3, 6)]:
obj = TixianQuotaDefault.objects.filter(leixing=total_code).first()
total_limit_map[leixing] = float(obj.default_quota) if obj else 0.0
for withdraw_leixing, quota_leixing in [(1, 4), (2, 5), (3, 6), (4, 7), (5, 8), (6, 9)]:
obj = TixianQuotaDefault.objects.filter(leixing=quota_leixing).first()
total_limit_map[withdraw_leixing] = float(obj.default_quota) if obj else 0.0
# 4. 当日已提现总额
# 4. 当日已提现总额(按提现类型 leixing 1~6
today = date.today()
today_totals = {1: 0.0, 2: 0.0, 3: 0.0}
today_totals = {i: 0.0 for i in range(1, 7)}
records = TixianRiTongji.objects.filter(riqi=today)
for rec in records:
today_totals[rec.leixing] = float(rec.total_amount)
if rec.leixing in today_totals:
today_totals[rec.leixing] = float(rec.total_amount)
# 🆕 获取提现模式自动1 / 手动2默认2
from peizhi.models import WithdrawConfig # 确保导入模型
@@ -6874,8 +6872,8 @@ class UpdateWithdrawSettingsView(APIView):
rate_code_map = {1: '5', 2: '6', 3: '8', 4: '9', 5: '11', 6: '10'}
# 订单/押金分红1平台订单/3商家订单/12押金管事/13商家订单管事分红
order_rate_code_map = {1: '1', 3: '3', 12: '12', 13: '13'}
# 总限额对应的 leixing 值4,5,6
total_code_map = {1: 4, 2: 5, 3: 6}
# 总限额:提现类型 → TixianQuotaDefault.leixing4~9
total_code_map = {1: 4, 2: 5, 3: 6, 4: 7, 5: 8, 6: 9}
def _rate_key_present(data, role):
return (str(role) in data and data[str(role)] is not None) or \
@@ -6888,14 +6886,20 @@ class UpdateWithdrawSettingsView(APIView):
if perm_needed not in permissions:
if _rate_key_present(rates, role) or \
(str(role) in quotas and quotas[str(role)] is not None) or \
(str(role) in total_limits and total_limits[str(role)] is not None):
(role in quotas and quotas.get(role) is not None) or \
(str(role) in total_limits and total_limits[str(role)] is not None) or \
(role in total_limits and total_limits.get(role) is not None):
return Response({'code': 403, 'msg': f'无权限修改{["","打手","管事","组长"][role]}相关设置(需要{perm_needed}'})
# 其他提现手续费(审核官/打手押金/商家余额):需 5500a/b/c 任一
extra_role_names = {4: '考核官', 5: '打手押金', 6: '商家余额'}
for role in [4, 5, 6]:
if _rate_key_present(rates, role) and not any(p in permissions for p in ('5500a', '5500b', '5500c')):
role_names = {4: '审核官', 5: '打手押金', 6: '商家余额'}
return Response({'code': 403, 'msg': f'无权限修改{role_names[role]}提现手续费率'})
return Response({'code': 403, 'msg': f'无权限修改{extra_role_names[role]}提现手续费率'})
if (str(role) in total_limits and total_limits[str(role)] is not None) or \
(role in total_limits and total_limits.get(role) is not None):
if not any(p in permissions for p in ('5500a', '5500b', '5500c')):
return Response({'code': 403, 'msg': f'无权限修改{extra_role_names[role]}总限额'})
# 订单/押金分红费率:需 5500a/b/c 任一
for role in [1, 3, 12, 13]:
@@ -6948,20 +6952,19 @@ class UpdateWithdrawSettingsView(APIView):
obj.default_quota = quota
obj.save()
# 3. 修改每日总限额
for role in [1, 2, 3]:
if str(role) in total_limits:
val = total_limits[str(role)]
if val is not None:
limit = Decimal(str(val))
code = total_code_map[role]
obj, created = TixianQuotaDefault.objects.select_for_update().get_or_create(
leixing=code,
defaults={'default_quota': limit}
)
if not created:
obj.default_quota = limit
obj.save()
# 3. 修改每日总限额1打手/2管事/3组长/4考核官/5押金/6商家
for role in [1, 2, 3, 4, 5, 6]:
val = total_limits.get(str(role), total_limits.get(role))
if val is not None:
limit = Decimal(str(val))
code = total_code_map[role]
obj, created = TixianQuotaDefault.objects.select_for_update().get_or_create(
leixing=code,
defaults={'default_quota': limit}
)
if not created:
obj.default_quota = limit
obj.save()
# 🆕 修改提现模式有5500a/b/c任一即可
from peizhi.models import WithdrawConfig
@@ -6980,8 +6983,6 @@ class UpdateWithdrawSettingsView(APIView):
class GetZuzhangListView(APIView):
"""
组长列表接口(分页 + 多条件筛选)

View File

@@ -218,7 +218,8 @@ class TixianQuotaDefault(models.Model):
"""
id = models.AutoField(primary_key=True)
leixing = models.IntegerField(
choices=[(1, '打手'), (2, '管事')],
choices=[(1, '打手'), (2, '管事'), (3, '组长'),
(4, '考核官'), (5, '打手押金'), (6, '商家余额')],
unique=True,
verbose_name='用户类型'
)