From df8eff153226ad297767808d018045bf2f1c41cc Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Mon, 24 Mar 2025 11:13:12 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E5=B7=A5=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/controller/Ticket.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/plugs/think-plugs-ticket/src/controller/Ticket.php b/plugs/think-plugs-ticket/src/controller/Ticket.php index 695c0a7..83dbab4 100644 --- a/plugs/think-plugs-ticket/src/controller/Ticket.php +++ b/plugs/think-plugs-ticket/src/controller/Ticket.php @@ -467,17 +467,31 @@ class Ticket extends Controller if ($ticket->isEmpty()) { $this->error('未找到工单信息'); } + if (sizeof($ticket->views) === 0) { + if (sizeof($ticket->inspection_shares) === 0) { + $this->error('请先提请核验工单!'); + } else { + $view = $ticket->inspection_shares[0]; + } + } else { + $view = $ticket->views[0]; + } if ($this->request->isPost()) { $adminInfo = $this->request->session('user'); $instance_data = $this->_vali([ 'staff_id.require'=>'请指定维修人员!', + 'kj_user_id.default'=>'0', ]); - $view = $ticket->repairs()->save([ + $ticket->kj_user_id = $instance_data['kj_user_id']; + $repair = $ticket->repairs()->save([ + 'gc_content'=>$view->gc_content, + 'zf_content'=>$view->zf_content, + 'ys_content'=>$view->ys_content, 'staff_id'=>$instance_data['staff_id'], 'status'=>0, 'create_by'=>$adminInfo['id'], ]); - $this->success('创建成功!', $view); + $this->success('创建成功!', $repair); } else { $this->vo = $ticket; $this->staffs = $staffs;