diff --git a/Application/Admin/Controller/PartnerController.class.php b/Application/Admin/Controller/PartnerController.class.php index 84224f525..b7f2338ac 100644 --- a/Application/Admin/Controller/PartnerController.class.php +++ b/Application/Admin/Controller/PartnerController.class.php @@ -244,7 +244,7 @@ class PartnerController extends ThinkController $map["create_time"] = ['ELT',$time_end]; } $model = M("partner_verify", 'tab_'); - $data = $model->where($map)->page($page,$row)->order("FIELD(verify_log,0,1,-1),create_time desc")->select(); + $data = $model->where($map)->page($page,$row)->order("FIELD(verify_status,0,1,-1),create_time desc")->select(); foreach ($data as $k => &$v) { $v['partner_info'] = json_decode($v['partner_info'],true); if($v['partner_id'] == 0){ diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index 4ce35f447..8e833562e 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -15,7 +15,11 @@ use Think\Controller; class PromoteCompanyController extends ThinkController { private $modelName = 'PromoteCompany'; - + public function _initialize() + { + $this->admininfo = $_SESSION['onethink_admin']['user_auth']; + parent::_initialize(); + } //列表 public function lists() { @@ -229,6 +233,194 @@ class PromoteCompanyController extends ThinkController $this->meta_title = '推广公司'; $this->display(); } + public function index() + { + $page = intval(I('get.p', 0)); + $page = $page ? $page : 1; //默认显示第一页数据 + $row = intval(I('row', 0)); + $row = empty($row) ? 10 : $row;//每页条数 + $p = $_REQUEST; + + if(!IS_ROOT){ + $this->OpAuthList= getModuleControllerAuth(); + } + + $map = []; + if (!empty(I('company_name'))) { + $map['company_name'] = ['like', '%' . I('company_name') . '%']; + } + if (!empty($p['verify_type'])) { + if($p['verify_type'] == 1){ + $map['company_id'] = 0; + }else{ + $map['company_id'] = ["neq",0]; + } + } + if (!empty($p['verify_status'])) { + $map['verify_status'] = $p['verify_status']; + } + + if (isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])) { + $time_start = strtotime($_REQUEST['timestart']); + $time_end = strtotime($_REQUEST['timeend'])+ 86399; + $map["create_time"] =['BETWEEN',[$time_start, $time_end]]; + } elseif (isset($_REQUEST['timestart'])) { + $time_start = strtotime($_REQUEST['timestart']); + $map["create_time"] =['EGT',$time_start]; + } elseif (isset($_REQUEST['timeend'])) { + $time_end = strtotime($_REQUEST['timeend'])+ 86399; + $map["create_time"] = ['ELT',$time_end]; + } + $model = M("promote_company_verify", 'tab_'); + $data = $model->where($map)->page($page,$row)->order("FIELD(verify_status,0,1,-1,-2,2),id desc")->select(); + foreach ($data as $k => &$v) { + $v['company_info'] = json_decode($v['company_info'],true); + if($v['company_id'] == 0){ + $v['verify_type'] = "新增"; + }else{ + $v['verify_type'] = "修改"; + } + $v['company_info']['company_type'] = $v['company_info']['company_type'] == 2 ? '个人' : '公司'; + + $contract_start_time = $v['company_info']['contact_begin'] ? + time_format($v['company_info']['contact_begin'], 'Y/m/d') : '-'; + $contract_end_time = $v['company_info']['contact_end'] ? + time_format($v['company_info']['contact_end'], 'Y/m/d') : '-'; + $v['contract_time'] = $contract_start_time . '-' . $contract_end_time; + + $validity_start_time = $v['company_info']['validity_start_time'] ? + time_format($v['company_info']['validity_start_time'], 'Y/m/d') : '-'; + $validity_end_time = $v['company_info']['validity_end_time'] ? + time_format($v['company_info']['validity_end_time'], 'Y/m/d') : '-'; + $v['validity_time'] = $validity_start_time . '-' . $validity_end_time; + $create_time = date("Y-m-d H:i:s",$v["create_time"]); + + $v['verify_log'] = json_decode($v['verify_log'], true); + $v["create"]= "{$v['verify_log']['create_user']}
{$v['verify_log']['create_time']}"; + if(isset($v['verify_log']['market_user'])){ + if($v['status'] == -1){ + $ts = "审核拒绝"; + }else{ + $ts = "审核通过"; + } + $v["market"]= "{$ts}({$v['verify_log']['market_user']})
{$v['verify_log']['market_time']}"; + }else{ + $v["market"] = '--'; + } + + if(isset($v['verify_log']['admin_user'])){ + if($v['status'] == -2){ + $ts = "审核拒绝"; + }else{ + $ts = "审核通过"; + } + $v["admin"]= "{$ts}({$v['verify_log']['admin_user']})
{$v['verify_log']['admin_time']}"; + }else{ + $v["admin"] = '--'; + } + + } + $count = $model->where($map)->count(); + $page = set_pagination($count, $row); + if ($page) { + $this->assign('_page', $page); + } + $this->assign('menubtn',$this->menuAuth()); + $this->assign('listData', $data); + $this->assign('count', $count); + $this->assign('VerifyStatus', D("PromoteCompanyVerify")->VerifyStatus); + $this->meta_title = '推广公司审核列表'; + $this->display(); + } + + public function marketAgree(){ + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $dbres = M("PromoteCompanyVerify", 'tab_')->field("id,verify_status,verify_log")->where("id in ({$ids})")->select(); + foreach($dbres as $k=>&$v){ + if($v['verify_status'] != 0) continue; + $v['verify_log'] = json_decode($v['verify_log'],true); + $v['verify_log']['market_user']=$this->admininfo["username"]; + $v['verify_log']['market_time']=date("Y-m-d H:i:s"); + $v['verify_log'] = json_encode($v['verify_log']); + $v['verify_status']=1; + M("PromoteCompanyVerify", 'tab_')->save($v); + addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"市场部审核",'url'=>U('index')]); + } + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"市场部审核通过成功" + )); + } + public function marketRefuse(){ + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $dbres = M("PromoteCompanyVerify", 'tab_')->field("id,verify_status,verify_log")->where("id in ({$ids})")->select(); + foreach($dbres as $k=>&$v){ + if($v['verify_status'] != 0) continue; + $v['verify_log'] = json_decode($v['verify_log'],true); + $v['verify_log']['market_user']=$this->admininfo["username"]; + $v['verify_log']['market_time']=date("Y-m-d H:i:s"); + $v['verify_log'] = json_encode($v['verify_log']); + $v['verify_status']=-1; + M("PromoteCompanyVerify", 'tab_')->save($v); + addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"市场部审核",'url'=>U('index')]); + } + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"市场部审核拒绝成功" + )); + } + public function adminRefuse(){ + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $dbres = M("PromoteCompanyVerify", 'tab_')->field("id,verify_status,verify_log")->where("id in ({$ids})")->select(); + foreach($dbres as $k=>&$v){ + if($v['verify_status'] != 1) continue; + $v['verify_log'] = json_decode($v['verify_log'],true); + $v['verify_log']['admin_user']=$this->admininfo["username"]; + $v['verify_log']['admin_time']=date("Y-m-d H:i:s"); + $v['verify_log'] = json_encode($v['verify_log']); + $v['verify_status']=-2; + M("PromoteCompanyVerify", 'tab_')->save($v); + addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"管理员审核",'url'=>U('index')]); + } + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"管理员审核拒绝成功" + )); + } + + public function adminAgree(){ + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $dbres = M("PromoteCompanyVerify", 'tab_')->field("*")->where("id in ({$ids})")->select(); + foreach($dbres as $k=>&$v){ + if($v['verify_status'] != 1) continue; + $v['verify_log'] = json_decode($v['verify_log'],true); + $v['verify_log']['admin_user']=$this->admininfo["username"]; + $v['verify_log']['admin_time']=date("Y-m-d H:i:s"); + $v['verify_log'] = json_encode($v['verify_log']); + $v['verify_status']=2; + $company_info = json_decode($v['company_info'],true); + if($v['company_id'] == 0){ + //新增 + $v['company_id'] = M("promote_company","tab_")->add($company_info); + }else{ + //编辑 + M("promote_company","tab_")->save($company_info); + $this->changePromote($company_info); + } + + //业务逻辑 + M("PromoteCompanyVerify", 'tab_')->save($v); + addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"管理员审核",'url'=>U('index')]); + } + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"管理员审核通过成功" + )); + } //添加 public function add() @@ -284,7 +476,7 @@ class PromoteCompanyController extends ThinkController if($data['resources'] == ''){ $data['resources'] ="[]"; } - + if($data['validity_start_time'] >0){ $data['validity_start_time']=date("Y-m-d",$data['validity_start_time']); }else{ @@ -302,8 +494,54 @@ class PromoteCompanyController extends ThinkController $data['turnover_ratio'] = $data['turnover_ratio'] ? json_decode($data['turnover_ratio'], true) : $data['turnover_ratio']; $this->assign('data', $data); + $this->meta_title ='推广公司信息查看'; $this->display(); } + public function verifyView() + { + if(!isset($_REQUEST['id'])) $this->error('数据异常', U('index')); + $id = $_REQUEST['id']; + $map['id'] = $id; + $dbres = M("PromoteCompanyVerify", 'tab_')->find($id); + $data = json_decode($dbres['company_info'],true); + + + if($data['contact_begin'] >0){ + $data['contact_begin']=date("Y-m-d",$data['contact_begin']); + }else{ + $data['contact_begin']=''; + } + if($data['contact_end'] >0){ + $data['contact_end']=date("Y-m-d",$data['contact_end']); + }else{ + $data['contact_end']=''; + } + if($data['resources'] == ''){ + $data['resources'] ="[]"; + } + + if($data['validity_start_time'] >0){ + $data['validity_start_time']=date("Y-m-d",$data['validity_start_time']); + }else{ + $data['validity_start_time']=''; + } + if($data['validity_end_time'] >0){ + $data['validity_end_time']=date("Y-m-d",$data['validity_end_time']); + }else{ + $data['validity_end_time']=''; + } + + if($data['resources'] == ''){ + $data['resources'] ="[]"; + } + $data['turnover_ratio'] = $data['turnover_ratio'] ? json_decode($data['turnover_ratio'], true) : $data['turnover_ratio']; + + $this->assign('data', $data); + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/edit'])->find()); + $this->meta_title ='审核信息查看'; + $this->display("view"); + } + public function marketingDirectorShow($ids=[], $isShow=0) { @@ -812,26 +1050,61 @@ class PromoteCompanyController extends ThinkController protected function changePromote(&$save){ $is_change_belong = false; $is_change_relation =false; + $is_change_game =false; if(empty($save['id'])){ return false; } $company_id = $save['id']; - $old_info = M("PromoteCompany","tab_")->field("company_belong,develop_type")->where("id = {$save['id']}")->find(); + $old_info = M("PromoteCompany","tab_")->field("company_belong,develop_type,game_ids")->where("id = {$save['id']}")->find(); if(isset($save['company_belong']) && ($old_info['company_belong'] != $save['company_belong'])){ $is_change_belong = true; } if(isset($save['develop_type']) && ($old_info['develop_type'] != $save['develop_type'])){ $is_change_relation = true; } + //获取需要扣除的游戏 + if($old_info['game_ids'] != $save['game_ids']){ + // $is_change_game = true; + $oids = explode(',', $old_info['game_ids']); + $nids = explode(',', $save['game_ids']); + $diff_ids = []; + if(count($oids) == 0){ + $is_change_game = false; + }elseif(count($nids) == 0){ + $diff_ids = $oids; + }else{ + foreach ($nids as $k => $v) { + if(!in_array($v,$oids)){ + $diff_ids[] = $v; + } + } + } + if(count($diff_ids) > 0){ + $is_change_game = true; + } + } //处理底下所有会长的公会属性 - if($is_change_belong || $is_change_relation){ - $savedata = array( - "company_belong"=>$save['company_belong'], - "company_relation"=>$save['develop_type'] - ); - M("Promote","tab_")->where("company_id = '{$company_id}'")->save($savedata); - + if($is_change_belong || $is_change_relation || $is_change_game){ + + if(!$is_change_game){ + $savedata = array( + "company_belong"=>$save['company_belong'], + "company_relation"=>$save['develop_type'] + ); + M("Promote","tab_")->where("company_id = '{$company_id}'")->save($savedata); + }else{ + //需要扣除游戏 + $Promote = M("Promote","tab_"); + $dbres = $Promote->field("id,game_ids,company_belong,company_relation")->where("company_id = '{$company_id}'")->select(); + foreach($dbres as $k=>&$v){ + $temp_ids = explode(',',$v['game_ids']); + $v['game_ids'] = implode(',', array_diff($temp_ids,$diff_ids)); + $v['company_belong'] = $save['company_belong']; + $v['company_relation'] = $save['develop_type']; + $Promote->save($v); + } + } // 权限跟随 if($is_change_belong){ $authGroup = M('auth_group',"sys_")->where(['title'=>'市场总监'])->find(); @@ -846,6 +1119,27 @@ class PromoteCompanyController extends ThinkController } } } + protected function menuAuth() + { + $addurl = U("addRelation"); + $mentBtn = [ + "marketAgree"=>"市场部审批通过", + "marketRefuse"=>"市场部审核拒绝", + "adminAgree"=>"管理员审核通过", + "adminRefuse"=>"管理员审核拒绝" + ]; + $resarr = []; + foreach ($mentBtn as $k => $v) { + if(IS_ROOT){ + $resarr[] = $v; + }else{ + if(in_array($k,$this->OpAuthList)){ + $resarr[] = $v; + } + } + } + return $resarr; + } } diff --git a/Application/Admin/Model/PromoteCompanyVerifyModel.class.php b/Application/Admin/Model/PromoteCompanyVerifyModel.class.php index ce5c747f4..4030406e4 100644 --- a/Application/Admin/Model/PromoteCompanyVerifyModel.class.php +++ b/Application/Admin/Model/PromoteCompanyVerifyModel.class.php @@ -8,9 +8,11 @@ class PromoteCompanyVerifyModel extends Model { protected $tablePrefix = 'tab_'; public $VerifyStatus=[ - "-1"=>"审核拒绝", + "-2"=>"管理员审核拒绝", + "-1"=>"市场部审核拒绝", "0"=>"未审核", - "1"=>"审核通过" + "1"=>"市场部审核通过", + "2"=>"管理员审核通过" ]; /** * 新增 diff --git a/Application/Admin/View/PromoteCompany/index.html b/Application/Admin/View/PromoteCompany/index.html new file mode 100644 index 000000000..57223aa57 --- /dev/null +++ b/Application/Admin/View/PromoteCompany/index.html @@ -0,0 +1,375 @@ + + + + + + + + + + + +
+
+
+ +
+ +
+   +
+ +
+ +
+ +
+ + - +
+ + +
+
+ +
+ +
+ +
+ 搜索 +
+
+
+
+
+ + {$vo} + +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 合同合作方名称对应平台审核类型公司性质合同期限结算生效期限渠道费率开票税点税费费率帐户名银行账号收款银行创建记录市场部审批管理员审批 操作
aOh! 暂时还没有内容!
+ + {$data.company_name}{$data.company_info.platform_name}{$data.verify_type}{$data.company_info.company_type}{$data.contract_time}{$data.validity_time}{$data.company_info.channel_rate}%{$data.company_info.fax_ratio}%{$data.company_info.taxation_rate}%{$data.company_info.bank_address}{$data.company_info.bank_card}{$data.company_info.bank_name}{$data.create} + +
+ {$data.market} +
+ +
+ {$data.market} +
+
+
+ +
+ {$data.admin} +
+ +
+ {$data.admin} +
+
+
+ 查看 +
+
+
+
+ {$_page|default=''} +
+
+ + + + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + + + diff --git a/Application/Admin/View/PromoteCompany/lists.html b/Application/Admin/View/PromoteCompany/lists.html index a206b3c95..ffe83d18a 100644 --- a/Application/Admin/View/PromoteCompany/lists.html +++ b/Application/Admin/View/PromoteCompany/lists.html @@ -44,6 +44,10 @@ @@ -272,7 +276,7 @@
-
选择游戏:
+
可推广游戏:
全部 A @@ -305,21 +309,11 @@
-
- -
-
-
确定
-
取消
-
@@ -434,28 +428,14 @@ if(ele.game_name.length>6){ ele.game_name = ele.game_name .substring(0,6)+"..." } - lis.push('
  • '); - - - // if(promote_info['game_ids']==''){ - // lis.push(''); - // }else{ - if(promote_info['game_ids'].indexOf(ele.id)>-1){ - lis.push(''); - }else{ - $(".jsgamecheckall").attr('checked',false); - lis.push(''); - checked = ''; - } - // } - - lis.push(''); - lis.push(''+ele.game_name+''); - lis.push('
  • '); + if(promote_info['game_ids'].indexOf(ele.id)>-1){ + lis.push('
  • '); + lis.push(''); + lis.push(''); + lis.push(''+ele.game_name+''); + lis.push('
  • '); + } }); - - $(".jsgamecheckall").attr('checked',checked); - $("#game_list").html(lis.join('')); $(".pro_promot_number").text(res.data.promote_info.company_name); $("#se_promote_id").val(res.data.promote_info.id); @@ -473,7 +453,6 @@ //保存修改 $(".pro_promot_btn_confirm").click(function(){ $("#ajaxForm").ajaxSubmit(function(res){ - layer.msg(res.msg); $(".pro_promot").hide(); }); return false; @@ -486,7 +465,6 @@ //取消修改 $(".pro_promot_btn_cancel").click(function(){ $(".pro_promot").css("display","none"); - layer.msg('修改已取消'); }); $(".jsgamecheckall").click(function(){ diff --git a/Application/Admin/View/PromoteCompany/view.html b/Application/Admin/View/PromoteCompany/view.html index 6e374e61b..40f1aebfb 100644 --- a/Application/Admin/View/PromoteCompany/view.html +++ b/Application/Admin/View/PromoteCompany/view.html @@ -81,7 +81,7 @@
    @@ -527,41 +527,6 @@ link.href = url; link.click() }); - $(".filedel").on("click",function(){ - layer.confirm('删除将即时生效,并且无法回退。请慎重选择', {icon: 2, title:'删除提示'}, function(index){ - var path = $(this).data("path"); - var index = $(this).data("index"); - var id = {$data.id}; - var doccopy = doc.concat(); - doccopy.splice(index,1) - $.ajax({ - url:"{:U('PromoteCompany/delFile')}", - type:"post", - data:{ - "id":id, - "file_path":path, - "resources":doccopy - }, - dataType:"json", - success:function(data){ - if(data.status == 1){ - doc.splice(index,1); - layer.msg(data.info,function(){ - PROMOTE.juicerFun(); - }); - - }else{ - layer.alert(data.info); - } - }, - error:function(e){ - - } - }); - - }); - - }) } } @@ -570,7 +535,6 @@ if(!doc){ doc = []; } - var id = {$data.id}; PROMOTE.juicerFun(); function addFile(info) {