diff --git a/app/ticket/service/TicketService.php b/app/ticket/service/TicketService.php index f5a0d72..6250b5f 100644 --- a/app/ticket/service/TicketService.php +++ b/app/ticket/service/TicketService.php @@ -55,8 +55,20 @@ class TicketService { try { Db::beginTransaction(); - $attachment = $data['attachment']??[]; $logic = new TicketLogic(); + $result = $logic->find($data['id']); + + if(empty($result)){ + throw new BusinessException('工单不存在'); + } + if($result['user_id'] != $data['user_id']){ + throw new BusinessException('只能编辑自己的工单'); + } + if($result['status'] != 1){ + throw new BusinessException('只能修改待受理工单'); + } + + $attachment = $data['attachment']??[]; $result = $logic->edit($data); if(!empty($attachment)){