修复了一些
This commit is contained in:
@@ -50,10 +50,10 @@ from users.models import (
|
||||
)
|
||||
from gvsdsdk.models import User
|
||||
|
||||
from orders.models import Lilubiao
|
||||
from orders.models import CommissionRate
|
||||
from config.models import Szjilu, Gonggao, Lunbo
|
||||
|
||||
from orders.models import Fadan # 用于罚款类型
|
||||
from orders.models import Penalty # 用于罚款类型
|
||||
|
||||
import traceback
|
||||
|
||||
@@ -615,7 +615,7 @@ class YajinHuitiao(View):
|
||||
|
||||
logger.info(f"打手押金更新成功: 用户{order.yonghuid}, 增加{order_amount_yuan}元, 新押金{dashou.yajin}")
|
||||
|
||||
# 8b. 押金分红(仅微信确认到账后;费率 Lilubiao fadanpingtai=12)
|
||||
# 8b. 押金分红(仅微信确认到账后;费率 CommissionRate Platform=12)
|
||||
try:
|
||||
|
||||
guanshi_id = dashou.yaoqingren
|
||||
@@ -624,8 +624,8 @@ class YajinHuitiao(View):
|
||||
elif Gsfenhong.query.filter(dingdan_id=order.dingdan_id).exists():
|
||||
logger.info(f"押金分红已处理: 订单{order.dingdan_id}")
|
||||
else:
|
||||
lilu_obj = Lilubiao.query.filter(fadanpingtai='12').first()
|
||||
rate = lilu_obj.lilu if lilu_obj and lilu_obj.lilu is not None else Decimal('0')
|
||||
lilu_obj = CommissionRate.query.filter(Platform='12').first()
|
||||
rate = lilu_obj.Rate if lilu_obj and lilu_obj.Rate is not None else Decimal('0')
|
||||
if rate <= 0:
|
||||
logger.info(f"押金分红跳过: 费率未配置或为0")
|
||||
else:
|
||||
@@ -6036,7 +6036,7 @@ class CzhqdyView(APIView):
|
||||
'name': '打手押金抵扣',
|
||||
'profile_attr': 'dashou_profile', # 与打手佣金共用扩展表
|
||||
'balance_field': 'yajin', # 押金字段
|
||||
'rate_key': '11', # 押金提现费率对应的 fadanpingtai
|
||||
'rate_key': '11', # 押金提现费率对应的 Platform
|
||||
'model': UserDashou,
|
||||
},
|
||||
]
|
||||
@@ -6089,18 +6089,18 @@ class CzhqdyView(APIView):
|
||||
elif leixing == 4:
|
||||
# 罚款缴纳
|
||||
try:
|
||||
fadan = Fadan.query.get(id=fadan_id, beichufa_id=user.yonghuid)
|
||||
target_price = fadan.fakuanjine
|
||||
except Fadan.DoesNotExist:
|
||||
fadan = Penalty.query.get(id=fadan_id, PenalizedUserID=user.yonghuid)
|
||||
target_price = fadan.FineAmount
|
||||
except Penalty.DoesNotExist:
|
||||
return Response({'code': 404, 'msg': '罚单不存在或不属于当前用户'}, status=status.HTTP_404_NOT_FOUND)
|
||||
|
||||
# 获取所有费率(打手佣金、管事分红、组长分红、打手押金)
|
||||
rates = {}
|
||||
for key in ['5', '6', '8', '11']:
|
||||
try:
|
||||
rate_obj = Lilubiao.query.get(fadanpingtai=key)
|
||||
rates[key] = rate_obj.lilu
|
||||
except Lilubiao.DoesNotExist:
|
||||
rate_obj = CommissionRate.query.get(Platform=key)
|
||||
rates[key] = rate_obj.Rate
|
||||
except CommissionRate.DoesNotExist:
|
||||
rates[key] = None # 未配置则跳过
|
||||
|
||||
# 构建可用身份列表
|
||||
@@ -6228,18 +6228,18 @@ class DsqrgmdhView(APIView):
|
||||
if not fadan_id:
|
||||
return Response({'code': 400, 'msg': '缺少罚单ID'}, status=status.HTTP_400_BAD_REQUEST)
|
||||
try:
|
||||
fadan_obj = Fadan.query.get(id=fadan_id, beichufa_id=request.user.yonghuid)
|
||||
target_price = fadan_obj.fakuanjine
|
||||
except Fadan.DoesNotExist:
|
||||
fadan_obj = Penalty.query.get(id=fadan_id, PenalizedUserID=request.user.yonghuid)
|
||||
target_price = fadan_obj.FineAmount
|
||||
except Penalty.DoesNotExist:
|
||||
return Response({'code': 404, 'msg': '罚单不存在或不属于当前用户'}, status=status.HTTP_404_NOT_FOUND)
|
||||
|
||||
identity = IDENTITY_CONFIG.get(shenfen_id)
|
||||
try:
|
||||
rate_obj = Lilubiao.query.get(fadanpingtai=identity['rate_key'])
|
||||
rate = rate_obj.lilu
|
||||
rate_obj = CommissionRate.query.get(Platform=identity['rate_key'])
|
||||
rate = rate_obj.Rate
|
||||
if rate >= 1:
|
||||
return Response({'code': 400, 'msg': f"{identity['name']}费率异常"}, status=status.HTTP_400_BAD_REQUEST)
|
||||
except Lilubiao.DoesNotExist:
|
||||
except CommissionRate.DoesNotExist:
|
||||
return Response({'code': 400, 'msg': f"{identity['name']}费率未配置"}, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
logger.info(f"目标价格={target_price}, 费率={rate}")
|
||||
|
||||
Reference in New Issue
Block a user