| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 | 
							- <?php
 
- namespace app\controller;
 
- use app\BaseController;
 
- use app\service\BaseService;
 
- use app\service\EnterprisesService;
 
- use app\validate\getListByqydm;
 
- use app\validate\Id;
 
- use app\validate\Page;
 
- use app\validate\Qydm;
 
- use think\db\exception\DataNotFoundException;
 
- use think\db\exception\DbException;
 
- use think\db\exception\ModelNotFoundException;
 
- use think\exception\ValidateException;
 
- use think\response\Json;
 
- use think\annotation\Route;
 
- use think\annotation\route\Middleware;
 
- use hg\apidoc\annotation as Apidoc;
 
- /**
 
-  * @Apidoc\Title("基地信息")
 
-  * @Apidoc\Group("基地")
 
-  * @Apidoc\Sort (7)
 
-  */
 
- class Base extends BaseController
 
- {
 
-     protected $middleware = [
 
-         'jwt',
 
-     ];
 
-     use ResponseJson;
 
-     /**
 
-      * @Apidoc\Title("通过企业代码查基地信息")
 
-      * @Apidoc\Tag("基地")
 
-      * @Apidoc\Method ("GET")
 
-      * @Apidoc\Author ("郑雪瑞")
 
-      * @Route("getBaseListByQydm",method="GET")
 
-      * @Middleware({"jwt"})
 
-      */
 
-     public function getBaseListByQydm():Json
 
-     {
 
-         $page=$this->request->get();
 
-         try{
 
-             validate(getListByqydm::class)->check($page);
 
-         }catch(ValidateException $e){
 
-             $this->JsonError($e->getError());
 
-         }
 
-         return $this->JsonSucess(BaseService::getBaseInfoByQydm($page,$page["qydm"])) ;
 
-     }
 
-     /**
 
-      * @Apidoc\Title("通过ID查基地信息")
 
-      * @Apidoc\Tag("基地")
 
-      * @Apidoc\Method ("GET")
 
-      * @Apidoc\Author ("郑雪瑞")
 
-      * @Route("getBaseInfoById",method="GET")
 
-      * @Middleware({"jwt"})
 
-      */
 
-     public function getBaseInfoById():Json
 
-     {
 
-         $id=$this->request->get();
 
-         try{
 
-             validate(Id::class)->check($id);
 
-         }catch(ValidateException $e){
 
-             $this->JsonError($e->getError());
 
-         }
 
-         return $this->JsonSucess(BaseService::getBaseInfoById($id["id"])) ;
 
-     }
 
-     /**
 
-      * @Apidoc\Title("删除基地信息")
 
-      * @Apidoc\Tag("基地")
 
-      * @Apidoc\Method ("POST")
 
-      * @Apidoc\Author ("郑雪瑞")
 
-      * @Route("delBaseInfoById",method="POST")
 
-      * @Middleware({"jwt"})
 
-      */
 
-     public function delBaseInfoById():Json
 
-     {
 
-         $id = $this->request->post();
 
-         try {
 
-             validate(Id::class)->check($id);
 
-         } catch (ValidateException $e) {
 
-             $this->JsonError($e->getError());
 
-         }
 
-         try {
 
-             return $this->JsonSucess(BaseService::delBase($id["id"]));
 
-         } catch (DataNotFoundException|ModelNotFoundException|DbException $dbE) {
 
-             return $this->JsonError($dbE);
 
-         }
 
-     }
 
-     /**
 
-      * @Apidoc\Title("通过ID更新基地信息")
 
-      * @Apidoc\Tag("基地")
 
-      * @Apidoc\Method ("POST")
 
-      * @Apidoc\Author ("郑雪瑞")
 
-      * @Route("updateBaseById",method="POST")
 
-      * @Middleware({"jwt"})
 
-      */
 
-     public function updateBaseById():Json
 
-     {
 
-         $info= $this->request->post();
 
-         try {
 
-             validate(Id::class)->check($info);
 
-         }catch (ValidateException $e){
 
-             $this->JsonError($e->getError());
 
-         }
 
-             return $this->JsonSucess(BaseService::editBaseInfo($info,$info["id"]));
 
-     }
 
-     /**
 
-      * @Apidoc\Title("添加基地信息")
 
-      * @Apidoc\Tag("基地")
 
-      * @Apidoc\Method ("POST")
 
-      * @Apidoc\Author ("郑雪瑞")
 
-      * @Route("addBaseInfo",method="POST")
 
-      * @Middleware({"jwt"})
 
-      */
 
-     public function addBaseInfo():Json
 
-     {
 
-         $info= $this->request->post();
 
-         try {
 
-             validate(\app\validate\Base::class)->check($info);
 
-         }catch (ValidateException $e){
 
-             $this->JsonError($e->getError());
 
-         }
 
-         return $this->JsonSucess(BaseService::addBase($info));
 
-     }
 
- }
 
 
  |