request->post(); try { validate(GridAdd::class)->check($gridInfo); $gridInfo['creation_time'] = date('Y-m-d h:i:s', time()); $result = GridService::addGrid($gridInfo); if (!$result){ return $this->JsonError(1002); } }catch (ValidateException $e){ return $this->JsonError($e->getError(),0); } return $this->JsonResponse(200,"success",""); } /** * @Apidoc\Author("ruicu") * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException * @Apidoc\Title("删除网格点") * @Apidoc\Tag("删除网格点") * @Apidoc\Method ("Post") * @Route("/delgrid",method="Post") * @Middleware({"jwt"}) */ //删除 public function del(): Json{ $id=$this->request->post(); try { validate(Id::class)->check($id); $result = GridService::delGrid($id); if (!$result){ return $this->JsonError(1002); } }catch (ValidateException $e){ return $this->JsonError($e->getError(),0); } return $this->JsonResponse(200,"success",""); } /** * @Apidoc\Author("ruicu") * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException * @Apidoc\Title("修改网格点信息") * @Apidoc\Tag("修改网格点信息") * @Apidoc\Method ("Get") * @Route("/editgrid",method="Get") * @Middleware({"jwt"}) */ //修改 public function updateGridById(): Json { $info= $this->request->get(); try { validate(Id::class)->check($info); }catch (ValidateException $e){ $this->JsonError($e->getError()); } try { return $this->JsonSucess(GridService::editGridInfo($info,$info["id"])); } catch (DataNotFoundException|ModelNotFoundException|DbException $dbE) { return $this->JsonError($dbE); } } /** * @Apidoc\Author("ruicu") * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException * @Apidoc\Title("查询网格点信息") * @Apidoc\Tag("查询网格点信息") * @Apidoc\Method ("Get") * @Route("/infogrid",method="Get") * @Middleware({"jwt"}) */ //查询 public function getGridList(): Json { $page = $this->request->get(); try { validate(Page::class)->check($page); }catch (ValidateException $e){ $page["page"]=1; $page["size"] = 15; } try { return $this->JsonSucess(GridService::getGridList($page, getXzqdmSub())); } catch (DataNotFoundException|ModelNotFoundException|DbException $dbE) { return $this->JsonError($dbE); } } }