From ea1f5ca2c17b720c60ab1382318f0de1f52d92c0 Mon Sep 17 00:00:00 2001 From: weiz Date: Wed, 25 Oct 2023 15:00:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E7=B1=BB=E5=9E=8B=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/AnimalBreedController.php | 5 +++-- app/api/controller/LandPlantController.php | 5 +++-- app/api/controller/PoultryBreedController.php | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/api/controller/AnimalBreedController.php b/app/api/controller/AnimalBreedController.php index 83e1ce55..3e5e0f46 100644 --- a/app/api/controller/AnimalBreedController.php +++ b/app/api/controller/AnimalBreedController.php @@ -38,6 +38,7 @@ Db::name('farmer_animal_pic')->insert([ 'animal_id' => $animalId, 'pic' => $params['pic'], + 'type' => 1, 'create_time' => time() ]); } @@ -100,8 +101,8 @@ //上传动物养殖情况图片 public function addAnimalPic(): Json { - $params = $this->request->post(['animal_id','pic']); - if(empty($params['animal_id']) || empty($params['pic'])){ + $params = $this->request->post(['animal_id','pic','type']); + if(empty($params['animal_id']) || empty($params['pic']) || empty($params['type']) || !in_array($params['type'],[1,2])){ return $this->fail('参数错误'); } //写入数据 diff --git a/app/api/controller/LandPlantController.php b/app/api/controller/LandPlantController.php index 4f873774..6d2f901e 100644 --- a/app/api/controller/LandPlantController.php +++ b/app/api/controller/LandPlantController.php @@ -88,6 +88,7 @@ if(!empty($params['pic'])){ Db::name('farmer_land_crop_pic')->insert([ 'crop_id' => $landCropId, + 'type' => 1, 'pic' => $params['pic'], 'create_time' => time() ]); @@ -101,8 +102,8 @@ public function addLandCropPic(): Json { //获取参数 - $params = $this->request->post(['crop_id','pic']); - if(empty($params['crop_id']) || empty($params['pic'])){ + $params = $this->request->post(['crop_id','pic','type']); + if(empty($params['crop_id']) || empty($params['pic']) || empty($params['type']) || !in_array($params['type'],[1,2,3])){ return $this->fail('参数错误'); } //写入数据 diff --git a/app/api/controller/PoultryBreedController.php b/app/api/controller/PoultryBreedController.php index 7cc30245..6591cd84 100644 --- a/app/api/controller/PoultryBreedController.php +++ b/app/api/controller/PoultryBreedController.php @@ -38,6 +38,7 @@ Db::name('farmer_poultry_pic')->insert([ 'poultry_id' => $animalId, 'pic' => $params['pic'], + 'type' => 1, 'create_time' => time() ]); } @@ -100,8 +101,8 @@ //上传家禽养殖情况图片 public function addPoultryPic(): Json { - $params = $this->request->post(['poultry_id','pic']); - if(empty($params['poultry_id']) || empty($params['pic'])){ + $params = $this->request->post(['poultry_id','pic','type']); + if(empty($params['poultry_id']) || empty($params['pic']) || empty($params['type']) || !in_array($params['type'],[1,2])){ return $this->fail('参数错误'); } //写入数据