request->post(); $inputInfo['creation_time'] = date('Y-m-d h:i:s', time()); try { validate(\app\validate\Inputuse::class)->check($inputInfo); }catch (ValidateException $e){ return $this->JsonError($e->getError()); } return $this->JsonSucess(InputuseService::addInputUse($inputInfo)); } /** * @Apidoc\Author("yang") * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException * @Apidoc\Title("删除投入品使用") * @Apidoc\Tag("投入品使用") * @Apidoc\Method ("POST") * @Route("/delInputuse",method="POST") * @Middleware({"jwt"}) */ public function delInputuse(): Json { $id = $this->request->post(); try { validate(Id::class)->check($id); } catch (ValidateException $e) { return $this->JsonError($e->getError(), 0); } return $this->JsonSucess(InputuseService::delInputUse($id["id"])); } /** * @Apidoc\Author("yang") * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException * @Apidoc\Title("修改投入品使用") * @Apidoc\Tag("修改投入品使用") * @Apidoc\Method ("POST") * @Route("/editInputuse",method="POST") * @Middleware({"jwt"}) */ public function editInputuse(): Json { $info= $this->request->post(); $info['last_update_time'] = date('Y-m-d h:i:s', time()); try { validate(Id::class)->check($info); }catch (ValidateException $e){ $this->JsonError($e->getError()); } return $this->JsonSucess(InputuseService::editInputUse($info,$info["id"])); } /** * @Apidoc\Author("yang") * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException * @Apidoc\Title("获取投入品使用记录") * @Apidoc\Tag("投入品") * @Apidoc\Method ("POST") * @Route("/getInputUseList",method="POST") * @Middleware({"jwt"}) */ public function getInputUseList(): Json { $page = $this->request->get(); try { validate(Page::class)->check($page); }catch (ValidateException $e){ return $this->JsonError($e->getError()); } return $this->JsonSucess(InputuseService::getInputUseList($page,getQydm())); } /** * @Apidoc\Author("yang") * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException * @Apidoc\Title("获取投入品使用详情") * @Apidoc\Tag("投入品") * @Apidoc\Method ("GET") * @Route("/getInputUseById",method="GET") * @Middleware({"jwt"}) */ public function getInputUseById(): Json { $id = $this->request->get(); try { validate(Id::class)->check($id); }catch (ValidateException $e){ return $this->JsonError($e->getError()); } return $this->JsonSucess(InputuseService::getInputUseById($id["id"])); } }