新增通过手机号码查找农户接口

This commit is contained in:
weiz 2023-11-02 16:42:39 +08:00
parent fafc964faf
commit 09a0ee4cc1

View File

@ -13,7 +13,7 @@ use think\response\Json;
class InformationController extends BaseApiController
{
public array $notNeedLogin = ['groupServiceInfo','captainInfo','farmerInfo','farmerLandInfo','farmerPondInfo','farmerList'];
public array $notNeedLogin = ['groupServiceInfo','captainInfo','farmerInfo','farmerInfoByPhone','farmerLandInfo','farmerPondInfo','farmerList'];
public function list()
{
@ -374,6 +374,19 @@ class InformationController extends BaseApiController
return $this->success('请求成功',$farmerInfo);
}
//通过手机号码查找农户
public function farmerInfoByPhone(): Json
{
$params = $this->request->post(['phone']);
if(empty($params['phone'])){
return $this->fail('参数错误');
}
$data = UserInformationg::where('phone',$params['phone'])
->field('id,name,phone,area_id,street_id,village_id,brigade_id,area_id area_name,street_id street_name,village_id village_name,brigade_id brigade_name,address')
->findOrEmpty();
return !$data->isEmpty() ? $this->success('请求成功',$data->toArray()) : $this->fail('请求失败');
}
//获取农户土地信息
public function farmerLandInfo(): Json
{