From b65c686f18fd53923334966a144de6561b16e699 Mon Sep 17 00:00:00 2001 From: weiz Date: Thu, 26 Oct 2023 09:14:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96=E5=86=9C?= =?UTF-8?q?=E6=88=B7=E6=B0=B4=E4=BA=A7=E5=85=BB=E6=AE=96=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/InformationController.php | 27 ++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/app/api/controller/InformationController.php b/app/api/controller/InformationController.php index 955b2ab0e..e0e87e715 100644 --- a/app/api/controller/InformationController.php +++ b/app/api/controller/InformationController.php @@ -12,7 +12,7 @@ use think\response\Json; class InformationController extends BaseApiController { - public array $notNeedLogin = ['farmerInfo','farmerLandInfo']; + public array $notNeedLogin = ['farmerInfo','farmerLandInfo','farmerPondInfo']; public function list() { @@ -204,7 +204,7 @@ class InformationController extends BaseApiController return $this->fail('参数错误_worker'); } //获取农户信息 - $data = UserInformationgDemand::field('id,data')->where('id',$params['land_id'])->where('information_id', $params['user_id'])->where('category_id',6)->where('category_child','7')->findOrEmpty()->toArray(); + $data = UserInformationgDemand::field('id,data')->where('id',$params['land_id'])->where('information_id', $params['user_id'])->where('category_id',6)->where('category_child',7)->findOrEmpty()->toArray(); if(empty($data)){ return $this->fail('数据不存在_worker'); } @@ -214,4 +214,27 @@ class InformationController extends BaseApiController ]; return $this->success('请求成功',$resData); } + + //获取农户鱼塘信息 + public function farmerPondInfo(): Json + { + //获取参数 + $params = $this->request->post(['user_id','pond_id']); + if(empty($params['user_id']) || empty($params['pond_id'])){ + return $this->fail('参数错误_worker'); + } + //获取农户信息 + $data = UserInformationgDemand::field('id,data')->where('id',$params['pond_id'])->where('information_id', $params['user_id'])->where('category_id',6)->where('category_child',32)->findOrEmpty()->toArray(); + if(empty($data) || empty($data['data'])){ + return $this->fail('数据不存在_worker'); + } + if($data['data']['breeding_type'] != 1){ + return $this->fail('数据错误_work'); + } + $resData = [ + 'pond_id' => $data['id'], + 'pond_area' => $data['data']['area'] + ]; + return $this->success('请求成功',$resData); + } }