request->get(); try { validate(Page::class)->check($page); }catch (ValidateException $e){ $page["page"]=1; $page["size"] = 10; } try { return $this->JsonSucess(QkjbService::getQkjbList($page, getXzqdmSub())); } catch (DataNotFoundException|ModelNotFoundException|DbException $dbE) { return $this->JsonError($dbE); } } /** * @Apidoc\Author("yang") * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException * @Apidoc\Title("添加情况简报") * @Apidoc\Tag("添加情况简报") * @Apidoc\Method ("POST") * @Route("/addQkjb",method="POST") * @Middleware({"jwt"}) */ public function addQkjb(): Json { $data = $this->request->post(); try { validate(Qkjb::class)->check($data); $data['creation_time'] = date('Y-m-d h:i:s', time()); $result = QkjbService::addQkjb($data); if (!$result){ return $this->JsonError(1002); } }catch (ValidateException $e){ return $this->JsonError($e->getError(),0); } return $this->JsonResponse(200,"success",""); } /** * @Apidoc\Author("yang") * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException * @Apidoc\Title("修改情况简报") * @Apidoc\Tag("修改情况简报") * @Apidoc\Method ("POST") * @Route("/editgrid",method="POST") * @Middleware({"jwt"}) */ //修改 public function updateQkjbById(): Json { $data= $this->request->get(); try { validate(Id::class)->check($data); }catch (ValidateException $e){ $this->JsonError($e->getError()); } try { return $this->JsonSucess(QkjbService::editQkjbInfo($data, $data["id"])); } catch (DataNotFoundException|ModelNotFoundException|DbException $dbE) { return $this->JsonError($dbE); } } /** * @Apidoc\Author("yang") * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException * @Apidoc\Title("删除情况简报") * @Apidoc\Tag("删除情况简报") * @Apidoc\Method ("Post") * @Route("/deleteqkjb",method="Post") * @Middleware({"jwt"}) */ //删除 public function deleteQkjbById(): Json{ $id=$this->request->post(); try { validate(Id::class)->check($id); $result = QkjbService::deleteQkjb($id); if (!$result){ return $this->JsonError(1002); } }catch (ValidateException $e){ return $this->JsonError($e->getError(),0); } return $this->JsonResponse(200,"success",""); } }