diff --git a/Application/Admin/Controller/CompanyRelationController.class.php b/Application/Admin/Controller/CompanyRelationController.class.php index 12461b49e..c4f129e25 100644 --- a/Application/Admin/Controller/CompanyRelationController.class.php +++ b/Application/Admin/Controller/CompanyRelationController.class.php @@ -302,18 +302,18 @@ class CompanyRelationController extends AdminController unset($v['remark']); unset($v['status']); unset($v['verify_log']); + //判断公司id及类型 + if($v['first_company_type'] == 0){ + $t_company_id = $v['second_company_id']; + $t_company_type = $v['second_company_type']; + }else{ + $t_company_id = $v['first_company_id']; + $t_company_type = $v['first_company_type']; + } $where = " - ( - (first_company_type ='{$v['first_company_type']}' and first_company_id = '{$v['first_company_id']}') + (first_company_type ='{$t_company_type}' and first_company_id = '{$t_company_id}') OR - (first_company_type ='{$v['second_company_type']}' and first_company_id = '{$v['second_company_id']}') - ) - AND - ( - (second_company_type ='{$v['first_company_type']}' and second_company_id = '{$v['first_company_id']}') - OR - (second_company_type ='{$v['second_company_type']}' and second_company_id = '{$v['second_company_id']}') - ) + (second_company_type ='{$t_company_type}' and second_company_id = '{$t_company_id}') "; $hasdb = $this->DBModel->where($where)->find(); if(isset($hasdb['id'])){