修复了跟自动提现有关的所有接口,增加了更多的校验条件,比如会员是否到期,每日限额校验,每日限额校验全部改到收款接口里,商家派单接口,减少了校验条件 ,比如前端没有传递会员ID或抢单要求类型的,一样可以派,每日限额表模型提现表,模型类型字段添加了几个数字,相当于添加了几种利率,管事押金以及订单分红利率 ,后台获取以及更改提现手续费的接口增加了几个利率的修改,商家结算接口,还有客服强制结算接口,增加了管事订单分红
This commit is contained in:
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
@@ -3012,7 +3012,7 @@ class ShangjiaPaifaView(APIView):
|
|||||||
commission_value_str = str(commission_value_raw).strip() if commission_value_raw is not None else ''
|
commission_value_str = str(commission_value_raw).strip() if commission_value_raw is not None else ''
|
||||||
|
|
||||||
# ----- 3. 必填校验 -----
|
# ----- 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}")
|
logger.warning(f"参数缺失: {request.data}")
|
||||||
return Response({'code': 400, 'msg': '缺少必填参数'})
|
return Response({'code': 400, 'msg': '缺少必填参数'})
|
||||||
|
|
||||||
|
|||||||
@@ -254,7 +254,8 @@ class TixianRiTongji(models.Model):
|
|||||||
"""
|
"""
|
||||||
riqi = models.DateField(db_index=True, verbose_name='日期')
|
riqi = models.DateField(db_index=True, verbose_name='日期')
|
||||||
leixing = models.IntegerField(
|
leixing = models.IntegerField(
|
||||||
choices=[(1, '打手'), (2, '管事'), (3, '组长')],
|
choices=[(1, '打手'), (2, '管事'), (3, '组长'),
|
||||||
|
(4, '考核官'), (5, '打手押金'), (6, '商家余额')],
|
||||||
verbose_name='用户类型'
|
verbose_name='用户类型'
|
||||||
)
|
)
|
||||||
total_amount = models.DecimalField(max_digits=12, decimal_places=2, default=0.00, verbose_name='当天提现总额(元)')
|
total_amount = models.DecimalField(max_digits=12, decimal_places=2, default=0.00, verbose_name='当天提现总额(元)')
|
||||||
|
|||||||
@@ -6766,9 +6766,6 @@ class UpdateGuanliView(APIView):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GetWithdrawSettingsView(APIView):
|
class GetWithdrawSettingsView(APIView):
|
||||||
"""
|
"""
|
||||||
获取提现设置(手续费利率、每日限额、当日已提现总额)
|
获取提现设置(手续费利率、每日限额、当日已提现总额)
|
||||||
@@ -6808,18 +6805,19 @@ class GetWithdrawSettingsView(APIView):
|
|||||||
obj = TixianQuotaDefault.objects.filter(leixing=leixing).first()
|
obj = TixianQuotaDefault.objects.filter(leixing=leixing).first()
|
||||||
quota_map[leixing] = float(obj.default_quota) if obj else 20.0
|
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 = {}
|
total_limit_map = {}
|
||||||
for leixing, total_code in [(1, 4), (2, 5), (3, 6)]:
|
for withdraw_leixing, quota_leixing in [(1, 4), (2, 5), (3, 6), (4, 7), (5, 8), (6, 9)]:
|
||||||
obj = TixianQuotaDefault.objects.filter(leixing=total_code).first()
|
obj = TixianQuotaDefault.objects.filter(leixing=quota_leixing).first()
|
||||||
total_limit_map[leixing] = float(obj.default_quota) if obj else 0.0
|
total_limit_map[withdraw_leixing] = float(obj.default_quota) if obj else 0.0
|
||||||
|
|
||||||
# 4. 当日已提现总额
|
# 4. 当日已提现总额(按提现类型 leixing 1~6)
|
||||||
today = date.today()
|
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)
|
records = TixianRiTongji.objects.filter(riqi=today)
|
||||||
for rec in records:
|
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
|
# 🆕 获取提现模式(自动1 / 手动2),默认2
|
||||||
from peizhi.models import WithdrawConfig # 确保导入模型
|
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'}
|
rate_code_map = {1: '5', 2: '6', 3: '8', 4: '9', 5: '11', 6: '10'}
|
||||||
# 订单/押金分红(1平台订单/3商家订单/12押金管事/13商家订单管事分红)
|
# 订单/押金分红(1平台订单/3商家订单/12押金管事/13商家订单管事分红)
|
||||||
order_rate_code_map = {1: '1', 3: '3', 12: '12', 13: '13'}
|
order_rate_code_map = {1: '1', 3: '3', 12: '12', 13: '13'}
|
||||||
# 总限额对应的 leixing 值(4,5,6)
|
# 总限额:提现类型 → TixianQuotaDefault.leixing(4~9)
|
||||||
total_code_map = {1: 4, 2: 5, 3: 6}
|
total_code_map = {1: 4, 2: 5, 3: 6, 4: 7, 5: 8, 6: 9}
|
||||||
|
|
||||||
def _rate_key_present(data, role):
|
def _rate_key_present(data, role):
|
||||||
return (str(role) in data and data[str(role)] is not None) or \
|
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 perm_needed not in permissions:
|
||||||
if _rate_key_present(rates, role) or \
|
if _rate_key_present(rates, role) or \
|
||||||
(str(role) in quotas and quotas[str(role)] is not None) 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})'})
|
return Response({'code': 403, 'msg': f'无权限修改{["","打手","管事","组长"][role]}相关设置(需要{perm_needed})'})
|
||||||
|
|
||||||
# 其他提现手续费(审核官/打手押金/商家余额):需 5500a/b/c 任一
|
# 其他提现手续费(审核官/打手押金/商家余额):需 5500a/b/c 任一
|
||||||
|
extra_role_names = {4: '考核官', 5: '打手押金', 6: '商家余额'}
|
||||||
for role in [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')):
|
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'无权限修改{extra_role_names[role]}提现手续费率'})
|
||||||
return Response({'code': 403, 'msg': f'无权限修改{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 任一
|
# 订单/押金分红费率:需 5500a/b/c 任一
|
||||||
for role in [1, 3, 12, 13]:
|
for role in [1, 3, 12, 13]:
|
||||||
@@ -6948,20 +6952,19 @@ class UpdateWithdrawSettingsView(APIView):
|
|||||||
obj.default_quota = quota
|
obj.default_quota = quota
|
||||||
obj.save()
|
obj.save()
|
||||||
|
|
||||||
# 3. 修改每日总限额
|
# 3. 修改每日总限额(1打手/2管事/3组长/4考核官/5押金/6商家)
|
||||||
for role in [1, 2, 3]:
|
for role in [1, 2, 3, 4, 5, 6]:
|
||||||
if str(role) in total_limits:
|
val = total_limits.get(str(role), total_limits.get(role))
|
||||||
val = total_limits[str(role)]
|
if val is not None:
|
||||||
if val is not None:
|
limit = Decimal(str(val))
|
||||||
limit = Decimal(str(val))
|
code = total_code_map[role]
|
||||||
code = total_code_map[role]
|
obj, created = TixianQuotaDefault.objects.select_for_update().get_or_create(
|
||||||
obj, created = TixianQuotaDefault.objects.select_for_update().get_or_create(
|
leixing=code,
|
||||||
leixing=code,
|
defaults={'default_quota': limit}
|
||||||
defaults={'default_quota': limit}
|
)
|
||||||
)
|
if not created:
|
||||||
if not created:
|
obj.default_quota = limit
|
||||||
obj.default_quota = limit
|
obj.save()
|
||||||
obj.save()
|
|
||||||
|
|
||||||
# 🆕 修改提现模式(有5500a/b/c任一即可)
|
# 🆕 修改提现模式(有5500a/b/c任一即可)
|
||||||
from peizhi.models import WithdrawConfig
|
from peizhi.models import WithdrawConfig
|
||||||
@@ -6980,8 +6983,6 @@ class UpdateWithdrawSettingsView(APIView):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GetZuzhangListView(APIView):
|
class GetZuzhangListView(APIView):
|
||||||
"""
|
"""
|
||||||
组长列表接口(分页 + 多条件筛选)
|
组长列表接口(分页 + 多条件筛选)
|
||||||
|
|||||||
@@ -218,7 +218,8 @@ class TixianQuotaDefault(models.Model):
|
|||||||
"""
|
"""
|
||||||
id = models.AutoField(primary_key=True)
|
id = models.AutoField(primary_key=True)
|
||||||
leixing = models.IntegerField(
|
leixing = models.IntegerField(
|
||||||
choices=[(1, '打手'), (2, '管事')],
|
choices=[(1, '打手'), (2, '管事'), (3, '组长'),
|
||||||
|
(4, '考核官'), (5, '打手押金'), (6, '商家余额')],
|
||||||
unique=True,
|
unique=True,
|
||||||
verbose_name='用户类型'
|
verbose_name='用户类型'
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user