From 1c661631eabfdf1eceb36469505279c40ab94bfc Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 17 Apr 2023 00:05:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8A=A0=E7=AD=BE=E5=92=8C=E5=8A=A0?= =?UTF-8?q?=E7=AD=BE=E5=AE=8C=E6=88=90=E6=8E=A5=E5=8F=A3=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wf/views.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/wf/views.py b/apps/wf/views.py index 4263c3ef..8742c47e 100755 --- a/apps/wf/views.py +++ b/apps/wf/views.py @@ -420,8 +420,10 @@ class TicketViewSet(CreateUpdateCustomMixin, CreateModelMixin, ListModelMixin, R """ 加签 """ - ticket = self.get_object() data = request.data + sr = TicketAddNodeSerializer(data=data) + sr.is_valid(raise_exception=True) + ticket = self.get_object() add_user = User.objects.get(pk=data['toadd_user']) ticket.participant_type = State.PARTICIPANT_TYPE_PERSONAL ticket.participant = add_user.id @@ -443,6 +445,10 @@ class TicketViewSet(CreateUpdateCustomMixin, CreateModelMixin, ListModelMixin, R 加签完成 """ ticket = self.get_object() + if ticket.in_add_node is False: + raise ParseError('该工单不在加签状态中') + elif ticket.participant != request.user.id: + raise ParseError('非当前加签人') ticket.participant_type = State.PARTICIPANT_TYPE_PERSONAL ticket.in_add_node = False ticket.participant = ticket.add_node_man.id