Merge pull request '新增获取农户水产养殖详情接口' (#144) from zhangwei into dev

Reviewed-on: #144
This commit is contained in:
weiz 2023-10-26 09:15:17 +08:00
commit 53cccbceb5

View File

@ -12,7 +12,7 @@ use think\response\Json;
class InformationController extends BaseApiController class InformationController extends BaseApiController
{ {
public array $notNeedLogin = ['farmerInfo','farmerLandInfo']; public array $notNeedLogin = ['farmerInfo','farmerLandInfo','farmerPondInfo'];
public function list() public function list()
{ {
@ -204,7 +204,7 @@ class InformationController extends BaseApiController
return $this->fail('参数错误_worker'); 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)){ if(empty($data)){
return $this->fail('数据不存在_worker'); return $this->fail('数据不存在_worker');
} }
@ -214,4 +214,27 @@ class InformationController extends BaseApiController
]; ];
return $this->success('请求成功',$resData); 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);
}
} }