完善判断逻辑
This commit is contained in:
parent
b2e6a6cf1a
commit
b9d30c8cbd
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user