补充修改

This commit is contained in:
2026-06-18 02:30:42 +08:00
parent f9da920e6b
commit 7ce545fedb
12 changed files with 23 additions and 1168 deletions

View File

@@ -3025,7 +3025,7 @@ class GetGuanliDetailView(APIView):
# 获取多次分红配置(按次数和会员组织)
# 查询该管事的所有多次分红记录
duoci_records = DuociFenhong.query.filter(UserUID=yonghuid).order_by('cishu')
duoci_records = DuociFenhong.query.filter(yonghuid=yonghuid).order_by('cishu')
custom_first = {} # 首次分红定制cishu=1
extra_map = {} # 其他次数 { cishu: { huiyuan_id: { guanshi_fenhong, jieshao, jiage } } }
@@ -3206,7 +3206,7 @@ class UpdateGuanliView(APIView):
# 4.2 首次定制分红cishu=1
if custom_first is not None and isinstance(custom_first, dict):
# 获取当前所有首次定制记录
existing_first = DuociFenhong.query.filter(UserUID=yonghuid, cishu=1)
existing_first = DuociFenhong.query.filter(yonghuid=yonghuid, cishu=1)
# 前端传来的定制字典 {会员ID: 金额}
for huiyuan_id, amount in custom_first.items():
try:
@@ -3215,7 +3215,7 @@ class UpdateGuanliView(APIView):
continue
if amount <= 0:
# 金额为0或负数表示删除定制
DuociFenhong.query.filter(UserUID=yonghuid, huiyuan=huiyuan_id, cishu=1).delete()
DuociFenhong.query.filter(yonghuid=yonghuid, huiyuan=huiyuan_id, cishu=1).delete()
else:
DuociFenhong.query.update_or_create(
yonghuid=yonghuid,
@@ -3266,7 +3266,7 @@ class UpdateGuanliView(APIView):
}
)
# 删除不在 keep_set 中的额外次数记录
existing_extra = DuociFenhong.query.filter(UserUID=yonghuid, cishu__gte=2)
existing_extra = DuociFenhong.query.filter(yonghuid=yonghuid, cishu__gte=2)
for record in existing_extra:
if (record.cishu, record.huiyuan) not in keep_set:
record.delete()
@@ -3716,7 +3716,7 @@ class GetZuzhangDetailView(APIView):
m['zuzhangfc'] = str(m['zuzhangfc'])
# 获取多次分红配置(按次数和会员组织)
duoci_records = DuociFenhong.query.filter(UserUID=yonghuid).order_by('cishu')
duoci_records = DuociFenhong.query.filter(yonghuid=yonghuid).order_by('cishu')
custom_first = {} # 首次分红定制cishu=1
extra_map = {} # 其他次数 { cishu: { huiyuan_id: { zuzhang_fenhong, jieshao, jiage } } }
@@ -3889,7 +3889,7 @@ class UpdateZuzhangView(APIView):
# 4.2 首次定制分红cishu=1
if custom_first is not None and isinstance(custom_first, dict):
existing_first = DuociFenhong.query.filter(UserUID=yonghuid, cishu=1)
existing_first = DuociFenhong.query.filter(yonghuid=yonghuid, cishu=1)
for huiyuan_id, amount in custom_first.items():
try:
amount = Decimal(str(amount))
@@ -3897,7 +3897,7 @@ class UpdateZuzhangView(APIView):
continue
if amount <= 0:
# 删除定制(恢复默认)
DuociFenhong.query.filter(UserUID=yonghuid, huiyuan=huiyuan_id, cishu=1).delete()
DuociFenhong.query.filter(yonghuid=yonghuid, huiyuan=huiyuan_id, cishu=1).delete()
else:
DuociFenhong.query.update_or_create(
yonghuid=yonghuid,
@@ -3946,7 +3946,7 @@ class UpdateZuzhangView(APIView):
}
)
# 删除不在 keep_set 中的额外次数记录
existing_extra = DuociFenhong.query.filter(UserUID=yonghuid, cishu__gte=2)
existing_extra = DuociFenhong.query.filter(yonghuid=yonghuid, cishu__gte=2)
for record in existing_extra:
if (record.cishu, record.huiyuan) not in keep_set:
record.delete()