优化审核通过

master
chenzhi 4 years ago
parent 4dd8526e2b
commit 832f531d20

@ -384,23 +384,23 @@ class CompanyRelationController extends AdminController
}
$params['verify_log']=json_encode($verify_log);
//判断已有未审核
//判断哪方是非官方
if($params['first_company_type'] > 0){
$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']}')
";
}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
(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']}')
";
}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']}')
)
";
}
$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 = [];

@ -48,6 +48,9 @@
font-weight: 600;
font-size: 18px;
}
.confirm{
cursor: pointer;
}
</style>
<div class="cf top_nav_list">
@ -212,6 +215,28 @@ $(function(){
var url = "{:U('edit')}"+"&id="+id;
window.location.href = url;
})
$(".del").on("click",function(){
var id = $(this).data("id");
var url = "{:U('del')}"+"&id="+id;
layer.confirm('删除后将无法恢复,请慎重选择', {
closeBtn:0,
title:false,
btn: ['取消','删除'] //按钮
}, function(index){
layer.close(index);
}, function(){
$.get(url,function(data){
if(data.code == 1){
layer.msg('<span style="color:white">'+data.msg+'<span>',{time: 1000},function(){
window.location.reload();
});
}else{
layer.msg(data.msg,{icon: 2});
}
});
});
})
var loop = 1;
var company_id = "{$_GET['company_id']??0}";

@ -228,8 +228,6 @@
</div>
<div class="page">
<a class="sch-btn export-btn"
href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a>
{$_page|default=''}
</div>

Loading…
Cancel
Save