From 364c45099afaa3e3d33b5742e22e12f4b1462511 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Fri, 23 Feb 2024 18:05:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E5=8C=BA=E5=8E=BF=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/CompanyController.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/app/api/controller/CompanyController.php b/app/api/controller/CompanyController.php index 83c21337c..566d3317f 100644 --- a/app/api/controller/CompanyController.php +++ b/app/api/controller/CompanyController.php @@ -355,13 +355,25 @@ class CompanyController extends BaseApiController * 查询镇农科公司 */ public function street_company(){ - $street=$this->request->param('street_code'); - $company=Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$street], true); - if($company){ - return $this->success('ok',['title'=>$company[0]['company_name'],'organization_code'=>$company[0]['organization_code']]); - }else{ - return $this->fail('当前区域无镇农科公司'); + $street=$this->request->param('street_code', ''); + $area=$this->request->param('area_code', ''); + if (!empty($street)) { + $company=Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$street], true); + if($company){ + return $this->success('ok',['title'=>$company[0]['company_name'],'organization_code'=>$company[0]['organization_code']]); + }else{ + return $this->fail('当前区域无镇农科公司'); + } } + if(!empty($area)) { + $company=Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 15,'area'=>$area], true); + if($company){ + return $this->success('ok',['title'=>$company[0]['company_name'],'organization_code'=>$company[0]['organization_code']]); + }else{ + return $this->fail('当前区域无供投公司'); + } + } + }