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); + } }