fix: 处罚/罚款列表俱乐部过滤与全部Tab;回填fadan club_id

This commit is contained in:
XingQue
2026-06-25 16:21:05 +08:00
parent 2bd45f8654
commit 8ee7814a45
4 changed files with 105 additions and 22 deletions

View File

@@ -8988,10 +8988,39 @@ class KefuPunishmentListView(APIView):
permission_classes = [IsAuthenticated]
parser_classes = [JSONParser]
@staticmethod
def _parse_status_list(raw):
"""兼容 status=[0,3]、\"0,3\"、单数字;空/all 表示不过滤。"""
if raw is None:
return None
if isinstance(raw, str):
s = raw.strip().lower()
if not s or s in ('all', 'null', 'none'):
return None
if s.startswith('['):
import json
try:
raw = json.loads(s)
except (TypeError, ValueError):
return None
else:
raw = [x.strip() for x in s.split(',') if x.strip()]
if isinstance(raw, (int, float)):
return [int(raw)]
if isinstance(raw, list):
out = []
for x in raw:
try:
out.append(int(x))
except (TypeError, ValueError):
continue
return out or None
return None
def post(self, request):
# 1. 获取参数
phone = request.data.get('phone', '').strip()
status_list = request.data.get('status')
status_list = self._parse_status_list(request.data.get('status'))
dingdan_id = request.data.get('dingdan_id', '').strip()
dashouid = request.data.get('dashouid', '').strip()
try: