From b9d30c8cbd744b4a5f54072d1018437ac121adff Mon Sep 17 00:00:00 2001 From: Zixiao Wang Date: Mon, 26 May 2025 10:37:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=88=A4=E6=96=AD=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/expertproducts/views.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/expertproducts/views.py b/apps/expertproducts/views.py index 5e54efa..18be2ba 100644 --- a/apps/expertproducts/views.py +++ b/apps/expertproducts/views.py @@ -366,12 +366,26 @@ class NegotiationViewSet(viewsets.ModelViewSet): def search_creator_by_status(self, request): """根据状态搜索达人""" status = request.data.get('status') + allowed_statuses = [ + 'brand_review', + 'price_negotiation', + 'contract_review', + 'draft_ready', + 'draft_approved', + 'published' + ] if not status: return Response({ 'code': 400, 'message': '未收到状态', 'data': None }) + if status not in allowed_statuses: + return Response({ + 'code': 400, + 'message': f"status参数不合法, 只能为: {', '.join(allowed_statuses)}", + 'data': None + }) # 查找符合状态的谈判 negotiations = Negotiation.objects.filter(status=status)