diff --git a/app/adminapi/controller/CompanyController.php b/app/adminapi/controller/CompanyController.php index 2590389f3..b8c559e84 100644 --- a/app/adminapi/controller/CompanyController.php +++ b/app/adminapi/controller/CompanyController.php @@ -25,6 +25,7 @@ use app\common\model\Company; use think\facade\Db; use app\common\logic\contract\ContractLogic; use app\common\model\contract\Contract; +use app\common\model\user\User; /** * Company控制器 @@ -229,8 +230,12 @@ class CompanyController extends BaseAdminController */ public function subordinate($company_id) { - $company = Company::findOrEmpty($company_id); - $result = loopGetChild(Company::class, $company->id, 'level_one', 'company_name,id,company_type,area,area area_name,street,street street_name,is_contract,area_manager,area_manager area_manager_name,master_name,master_phone'); + $ids=Contract::where('party_a',$company_id)->where('status',1)->where('type',1)->column('party_b'); + if($ids){ + $result=Company::where('id','in',$ids)->field('company_name,id,company_type,area,area area_name,street,street street_name,is_contract,area_manager,area_manager area_manager_name,master_name,master_phone')->select(); + }else{ + $result=[]; + } $data['lists'] = $result; return $this->success('success', $data); }