From 2446f2c912263bd5dee62f2465967e22d9b77627 Mon Sep 17 00:00:00 2001 From: XingQue Date: Fri, 12 Jun 2026 21:42:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E8=B7=9F=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=8F=90=E7=8E=B0=E6=9C=89=E5=85=B3=E7=9A=84=E6=89=80?= =?UTF-8?q?=E6=9C=89=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E7=9A=84=E6=A0=A1=E9=AA=8C=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E6=AF=94=E5=A6=82=E4=BC=9A=E5=91=98=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=88=B0=E6=9C=9F=EF=BC=8C=E6=AF=8F=E6=97=A5=E9=99=90=E9=A2=9D?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=EF=BC=8C=E6=AF=8F=E6=97=A5=E9=99=90=E9=A2=9D?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E5=85=A8=E9=83=A8=E6=94=B9=E5=88=B0=E6=94=B6?= =?UTF-8?q?=E6=AC=BE=E6=8E=A5=E5=8F=A3=E9=87=8C=EF=BC=8C=E5=95=86=E5=AE=B6?= =?UTF-8?q?=E6=B4=BE=E5=8D=95=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=87=8F=E5=B0=91?= =?UTF-8?q?=E4=BA=86=E6=A0=A1=E9=AA=8C=E6=9D=A1=E4=BB=B6=20=EF=BC=8C?= =?UTF-8?q?=E6=AF=94=E5=A6=82=E5=89=8D=E7=AB=AF=E6=B2=A1=E6=9C=89=E4=BC=A0?= =?UTF-8?q?=E9=80=92=E4=BC=9A=E5=91=98ID=E6=88=96=E6=8A=A2=E5=8D=95?= =?UTF-8?q?=E8=A6=81=E6=B1=82=E7=B1=BB=E5=9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=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=BA=86=E7=AE=A1=E4=BA=8B?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=88=86=E7=BA=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 8 ++++++ dingdan/views.py | 2 +- houtai/models.py | 3 ++- houtai/view.py | 63 ++++++++++++++++++++++++------------------------ peizhi/models.py | 3 ++- 5 files changed, 45 insertions(+), 34 deletions(-) create mode 100644 .idea/.gitignore diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/dingdan/views.py b/dingdan/views.py index d67d0fc..bbe3a4a 100644 --- a/dingdan/views.py +++ b/dingdan/views.py @@ -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': '缺少必填参数'}) diff --git a/houtai/models.py b/houtai/models.py index b252fb3..b2ed194 100644 --- a/houtai/models.py +++ b/houtai/models.py @@ -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='当天提现总额(元)') diff --git a/houtai/view.py b/houtai/view.py index 8f7211b..e4bd717 100644 --- a/houtai/view.py +++ b/houtai/view.py @@ -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.leixing(4~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): """ 组长列表接口(分页 + 多条件筛选) diff --git a/peizhi/models.py b/peizhi/models.py index 103b69e..1715daf 100644 --- a/peizhi/models.py +++ b/peizhi/models.py @@ -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='用户类型' )