|
|
|
@ -384,23 +384,23 @@ class CompanyRelationController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$params['verify_log']=json_encode($verify_log);
|
|
|
|
|
//判断已有未审核
|
|
|
|
|
$where = "
|
|
|
|
|
(
|
|
|
|
|
(first_company_type ='{$params['first_company_type']}' and first_company_id = '{$params['first_company_id']}')
|
|
|
|
|
OR
|
|
|
|
|
(first_company_type ='{$params['second_company_type']}' and first_company_id = '{$params['second_company_id']}')
|
|
|
|
|
)
|
|
|
|
|
AND
|
|
|
|
|
(
|
|
|
|
|
(second_company_type ='{$params['first_company_type']}' and second_company_id = '{$params['first_company_id']}')
|
|
|
|
|
//判断哪方是非官方
|
|
|
|
|
if($params['first_company_type'] > 0){
|
|
|
|
|
$where = "
|
|
|
|
|
(first_company_type ='{$params['first_company_type']}' and first_company_id = '{$params['first_company_id']}')
|
|
|
|
|
OR
|
|
|
|
|
(second_company_type ='{$params['first_company_type']}' and second_company_id = '{$params['first_company_id']}')
|
|
|
|
|
";
|
|
|
|
|
}else{
|
|
|
|
|
$where = "
|
|
|
|
|
(first_company_type ='{$params['second_company_type']}' and first_company_id = '{$params['second_company_id']}')
|
|
|
|
|
OR
|
|
|
|
|
(second_company_type ='{$params['second_company_type']}' and second_company_id = '{$params['second_company_id']}')
|
|
|
|
|
)
|
|
|
|
|
";
|
|
|
|
|
";
|
|
|
|
|
}
|
|
|
|
|
$r_res = $this->DBModel->where($where)->find();
|
|
|
|
|
if(!empty($r_res)){
|
|
|
|
|
$this->error('当前甲乙双方已有绑定关系');
|
|
|
|
|
$this->error('当前合作方已有绑定关系');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$hasdb = $this->DBlogModel->where($where)->find();
|
|
|
|
@ -413,8 +413,8 @@ class CompanyRelationController extends AdminController
|
|
|
|
|
//新增
|
|
|
|
|
$id = $this->DBlogModel->add($params);
|
|
|
|
|
}
|
|
|
|
|
addOperationLog(['op_type'=>0,'key'=>$id,'op_name'=>'新增','url'=>U('lists')]);
|
|
|
|
|
$this->ajaxReturn(["msg"=>"添加成功","code"=>1,"url"=>U("lists")]);
|
|
|
|
|
addOperationLog(['op_type'=>0,'key'=>$id,'op_name'=>'新增','url'=>U('index')]);
|
|
|
|
|
$this->ajaxReturn(["msg"=>"添加成功,请联系管理员尽快审核","code"=>1,"url"=>U("index")]);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
$this->assign('defaultCompanyTypeA', self::COMPANY_TYPE_DEFAULT_A);
|
|
|
|
@ -463,6 +463,7 @@ class CompanyRelationController extends AdminController
|
|
|
|
|
if(!isset($p['id'])){
|
|
|
|
|
$this->error('参数错误');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//查询
|
|
|
|
|
$y = $this->DBModel->where("id='{$p['id']}'")->find();
|
|
|
|
|
if($y['settlement_type'] != $p['settlement_type'] || $y['invoice_type'] != $p['invoice_type'] || $y['invoice_content'] != $p['invoice_content'] || $y['is_payment'] != $p['is_payment'] || $y['collection'] != $p['collection']){
|
|
|
|
@ -472,28 +473,34 @@ class CompanyRelationController extends AdminController
|
|
|
|
|
"create_user"=>$this->admininfo["username"],
|
|
|
|
|
"create_time"=>date("Y-m-d H:i:s")
|
|
|
|
|
];
|
|
|
|
|
if($p['first_company_type'] == 1 || $p['second_company_type'] == 1){
|
|
|
|
|
if($y['first_company_type'] == 1 || $y['second_company_type'] == 1){
|
|
|
|
|
//上游公司
|
|
|
|
|
$verify_log['market_user']= "AUTO";
|
|
|
|
|
$verify_log['market_time']= date("Y-m-d H:i:s");
|
|
|
|
|
$p['status'] = 1;
|
|
|
|
|
}
|
|
|
|
|
$p['verify_log'] = json_encode($verify_log);
|
|
|
|
|
//其他信息
|
|
|
|
|
$p['first_company_id'] = $y['first_company_id'];
|
|
|
|
|
$p['first_company_name'] = $y['first_company_name'];
|
|
|
|
|
$p['first_company_type'] = $y['first_company_type'];
|
|
|
|
|
$p['second_company_id'] = $y['second_company_id'];
|
|
|
|
|
$p['second_company_name'] = $y['second_company_name'];
|
|
|
|
|
$p['second_company_type'] = $y['second_company_type'];
|
|
|
|
|
}
|
|
|
|
|
if($p['first_company_type'] > 0){
|
|
|
|
|
$where = "
|
|
|
|
|
(first_company_type ='{$p['first_company_type']}' and first_company_id = '{$p['first_company_id']}')
|
|
|
|
|
OR
|
|
|
|
|
(second_company_type ='{$p['first_company_type']}' and second_company_id = '{$p['first_company_id']}')
|
|
|
|
|
";
|
|
|
|
|
}else{
|
|
|
|
|
$where = "
|
|
|
|
|
(first_company_type ='{$p['second_company_type']}' and first_company_id = '{$p['second_company_id']}')
|
|
|
|
|
OR
|
|
|
|
|
(second_company_type ='{$p['second_company_type']}' and second_company_id = '{$p['second_company_id']}')
|
|
|
|
|
";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$where = "
|
|
|
|
|
(
|
|
|
|
|
(first_company_type ='{$p['first_company_type']}' and first_company_id = '{$p['first_company_id']}')
|
|
|
|
|
OR
|
|
|
|
|
(first_company_type ='{$p['second_company_type']}' and first_company_id = '{$p['second_company_id']}')
|
|
|
|
|
)
|
|
|
|
|
AND
|
|
|
|
|
(
|
|
|
|
|
(second_company_type ='{$p['first_company_type']}' and second_company_id = '{$p['first_company_id']}')
|
|
|
|
|
OR
|
|
|
|
|
(second_company_type ='{$p['second_company_type']}' and second_company_id = '{$p['second_company_id']}')
|
|
|
|
|
)
|
|
|
|
|
";
|
|
|
|
|
$hasdb = $this->DBlogModel->where($where)->find();
|
|
|
|
|
if(!empty($hasdb)){
|
|
|
|
|
//覆盖
|
|
|
|
@ -504,8 +511,8 @@ class CompanyRelationController extends AdminController
|
|
|
|
|
//新增
|
|
|
|
|
$id = $this->DBlogModel->add($p);
|
|
|
|
|
}
|
|
|
|
|
addOperationLog(['op_type'=>1,'key'=>$p['id'],'op_name'=>'修改','url'=>U('lists')]);
|
|
|
|
|
$this->ajaxReturn(["msg"=>"修改成功","code"=>1,"url"=>U("lists")]);
|
|
|
|
|
addOperationLog(['op_type'=>1,'key'=>$p['id'],'op_name'=>'修改','url'=>U('index')]);
|
|
|
|
|
$this->ajaxReturn(["msg"=>"修改成功,请联系管理员尽快审核","code"=>1,"url"=>U("index")]);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
$params = I('get.');
|
|
|
|
@ -523,6 +530,22 @@ class CompanyRelationController extends AdminController
|
|
|
|
|
$this->display();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function del()
|
|
|
|
|
{
|
|
|
|
|
if(!isset($_REQUEST['id'])){
|
|
|
|
|
$this->error('参数错误');
|
|
|
|
|
}
|
|
|
|
|
$id = $_REQUEST['id'];
|
|
|
|
|
$res = $this->DBModel->where("id='{$id}'")->delete();
|
|
|
|
|
if($res !== false){
|
|
|
|
|
addOperationLog(['op_type'=>2,'key'=>$id,'op_name'=>'删除','url'=>U('index')]);
|
|
|
|
|
$this->ajaxReturn(["msg"=>"删除成功","code"=>1,"url"=>U("index")]);
|
|
|
|
|
}else{
|
|
|
|
|
$this->error('删除错误');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function delRelation()
|
|
|
|
|
{
|
|
|
|
|
if(!isset($_REQUEST['id'])){
|
|
|
|
@ -668,7 +691,7 @@ class CompanyRelationController extends AdminController
|
|
|
|
|
if($info['status'] == 2){
|
|
|
|
|
$optist = [];
|
|
|
|
|
}else{
|
|
|
|
|
$optist = ["editRelation","delRelation"];
|
|
|
|
|
$optist = ["delRelation"];
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
$resarr = [];
|
|
|
|
|