diff --git a/app/api/controller/CompanyController.php b/app/api/controller/CompanyController.php index 83c21337c..d3a8f74ee 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= Company::where(['company_type'=>15, 'area'=>$area])->findOrEmpty(); + if(!$company->isEmpty()){ + return $this->success('ok',['title'=>$company['company_name'],'organization_code'=>$company['organization_code']]); + }else{ + return $this->fail('当前区域无供投公司'); + } + } + } diff --git a/app/api/controller/ShopCallController.php b/app/api/controller/ShopCallController.php index 1e0f84c86..c0730dfc3 100644 --- a/app/api/controller/ShopCallController.php +++ b/app/api/controller/ShopCallController.php @@ -3,6 +3,7 @@ namespace app\api\controller; use app\common\logic\task\TaskLogic; +use app\common\model\auth\Admin; use app\common\model\Company; use app\common\model\dict\DictData; use app\common\model\task\Task; @@ -16,5 +17,20 @@ use think\facade\Log; */ class ShopCallController extends BaseApiController { - + public array $notNeedLogin = ['getVillageCompany']; + public function getVillageCompany() + { + $param = $this->request->param(); + $geoVillage = Db::name('geo_village')->where('village_id', $param['village_id'])->find(); + $company = Company::where(['village' =>$geoVillage['village_code'], 'company_type'=>17])->find(); + $find= Admin::where('id', $company['admin_id'])->field('avatar,id_card')->find(); + if($find){ + $company['avatar']=$find['avatar']; + $company['id_card']=$find['id_card']; + }else{ + $company['avatar']=''; + $company['id_card']=''; + } + return $this->success('成功', compact('company')); + } } \ No newline at end of file