request->get(); try { validate(Page::class)->check($page); }catch (ValidateException $e){ return $this->JsonError($e->getError()); } return $this->JsonSucess(InputService::getInputList($page,getQydm())); } /** * @Apidoc\Title("投入品信息by ID") * @Apidoc\Tag("企业") * @Apidoc\Method ("GET") * @Apidoc\Author ("yang") * @Route("getInputInfo",method="GET") * @Middleware({"jwt"}) */ public function getInputInfoById(): json { $id = $this->request->get(); try { validate(Id::class)->check($id); }catch (ValidateException $e){ return $this->JsonError($e->getError()); } return $this->JsonSucess(InputService::getInputById($id["id"])); } /** * @Apidoc\Title("删除投入品信息") * @Apidoc\Tag("企业") * @Apidoc\Method ("POST") * @Apidoc\Author ("wangzhen") * @Route("delInputById",method="POST") * @Middleware({"jwt"}) */ public function delInputById():json{ $id= $this->request->POST(); try { validate(Id::class)->check($id); }catch (ValidateException $e){ $this->JsonError($e->getError()); } try { return $this->JsonSucess(InputService::delInputById($id["id"])); } catch (DataNotFoundException|ModelNotFoundException|DbException $dbE) { return $this->JsonError($dbE); } } /** * @Apidoc\Title("更新投入品信息") * @Apidoc\Tag("企业") * @Apidoc\Method ("POST") * @Apidoc\Author ("yang") * @Route("updateInputById",method="POST") * @Middleware({"jwt"}) */ public function updataInputById():json{ $info= $this->request->POST(); try { validate(Id::class)->check($info); }catch (ValidateException $e){ $this->JsonError($e->getError()); } try { return $this->JsonSucess(InputService::eidtInputInfo($info,$info["id"])); } catch (DataNotFoundException|ModelNotFoundException|DbException $dbE) { return $this->JsonError($dbE); } } /** * @Apidoc\Title("添加投入品信息") * @Apidoc\Tag("企业") * @Apidoc\Method ("POST") * @Apidoc\Author ("yang") * @Route("addInput",method="POST") * @Middleware({"jwt"}) */ public function addInput():json{ $data = $this->request->post(); try { validate(InputAdd::class)->check($data); $data['creation_time'] = date('Y-m-d h:i:s', time()); $result = InputService::addInput($data); if (!$result){ return $this->JsonError(1002); } }catch (ValidateException $e){ return $this->JsonError($e->getError(),0); } return $this->JsonResponse(1,"success",""); } }