|
|
@ -561,13 +561,22 @@ class CompanyRelationController extends AdminController
|
|
|
|
//己方公司
|
|
|
|
//己方公司
|
|
|
|
$companyInfo = M("CompanyInfo","tab_")->field("id,partner company_name,link_man,link_phone")->where("status='1'")->select();
|
|
|
|
$companyInfo = M("CompanyInfo","tab_")->field("id,partner company_name,link_man,link_phone")->where("status='1'")->select();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$b = $this->getBindCompanyId($type);
|
|
|
|
|
|
|
|
if($b){
|
|
|
|
|
|
|
|
$map = [
|
|
|
|
|
|
|
|
"id"=>["NOT IN",$b]
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$map = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if($type == 1){
|
|
|
|
if($type == 1){
|
|
|
|
//上游
|
|
|
|
//上游
|
|
|
|
$companyInfo = M("Partner","tab_")->field("id,partner company_name,company_type,link_man,link_phone")->where("status='1'")->select();
|
|
|
|
$companyInfo = M("Partner","tab_")->where($map)->field("id,partner company_name,company_type,link_man,link_phone")->where("status='1'")->select();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($type == 2){
|
|
|
|
if($type == 2){
|
|
|
|
//下游游
|
|
|
|
//下游游
|
|
|
|
$companyInfo = M("PromoteCompany","tab_")->field("id,company_belong,company_name,company_type,settlement_contact link_man,contact_phone link_phone")->where("status='1'")->select();
|
|
|
|
$companyInfo = M("PromoteCompany","tab_")->where($map)->field("id,company_belong,company_name,company_type,settlement_contact link_man,contact_phone link_phone")->where("status='1'")->select();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
foreach($companyInfo as $k=>&$v){
|
|
|
|
foreach($companyInfo as $k=>&$v){
|
|
|
|
if(isset($v['company_belong'])){
|
|
|
|
if(isset($v['company_belong'])){
|
|
|
@ -608,6 +617,27 @@ class CompanyRelationController extends AdminController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $companyInfo;
|
|
|
|
return $companyInfo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取已绑定公司id
|
|
|
|
|
|
|
|
* @param [type] $type 1 上游 /2下游
|
|
|
|
|
|
|
|
* @return void
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
protected function getBindCompanyId($type){
|
|
|
|
|
|
|
|
$dbres = M("CompanyRelation","tab_")->where("first_company_type = {$type} OR second_company_type = {$type}")->field("first_company_id,second_company_id")->select();
|
|
|
|
|
|
|
|
if(empty($dbres)){
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$sendid = [];
|
|
|
|
|
|
|
|
foreach ($dbres as $k => $v) {
|
|
|
|
|
|
|
|
if($v['first_company_type'] == $type){
|
|
|
|
|
|
|
|
$sendid[] = $v['first_company_id'];
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$sendid[] = $v['second_company_id'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return implode(",",$sendid);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected function listMenuAuth(){
|
|
|
|
protected function listMenuAuth(){
|
|
|
|
$addurl = U("addRelation");
|
|
|
|
$addurl = U("addRelation");
|
|
|
|