diff --git a/Application/Admin/Controller/GameRatioMouldController.class.php b/Application/Admin/Controller/GameRatioMouldController.class.php index 7e3e65e17..b239b5584 100644 --- a/Application/Admin/Controller/GameRatioMouldController.class.php +++ b/Application/Admin/Controller/GameRatioMouldController.class.php @@ -33,12 +33,19 @@ class GameRatioMouldController extends AdminController if(isset($params['company_belong'])){ $where['m.company_belong'] = $params['company_belong']; } - $gameres = M("game","tab_")->field("tab_game.relation_game_id,tab_game.relation_game_name,IF(tab_game.original_package_name='','未配置',tab_game.original_package_name) original_package_name,tab_game_type.type_name game_type_name")->where($gamewhere)->join("tab_game_type on tab_game.game_type_id = tab_game_type.id")->group("tab_game.relation_game_id")->select(false); - - $dbres = $this->DBModel->alias('m')->join("LEFT JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")->where($where)->order('create_time desc, id desc')->page($page, $row)->select(); + $this->checkListOrCountAuthRestMap($where); + $gameres = M("game","tab_")->field("tab_game.relation_game_id,tab_game.relation_game_name,IF(tab_game.original_package_name='','未配置',tab_game.original_package_name) original_package_name,tab_game_type.type_name game_type_name")->where($gamewhere)->join("tab_game_type on tab_game.game_type_id = tab_game_type.id")->group("tab_game.relation_game_id")->select(false); + $dbres = $this->DBModel->alias('m')->join("LEFT JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")->where($where)->order('create_time desc, id desc'); + + if(isset($params['export'])){ + $dbres = $dbres->select(); + }else{ + $dbres = $dbres->page($page, $row)->select(); + } + foreach($dbres as $k=>&$v){ $v['create_time'] = date("Y-m-d H:i:s",$v['create_time']); - $v['company_belong'] = getCompanyBlong($v['company_belong']); + $v['company_belong'] ="下游".getCompanyBlong($v['company_belong']); $thisTurnoverRatios = $v['turnover_ratio'] ? json_decode($v['turnover_ratio'], true) : []; $thisRatioDtl = "默认:{$v['ratio']}%"; @@ -55,6 +62,23 @@ class GameRatioMouldController extends AdminController } $v['turnover_ratio_str'] = $thisRatioDtl; } + //判断导出 + if(isset($_REQUEST['export'])){ + $GetData = $_GET; + unset($GetData['export']); + addOperationLog(['op_type'=>3,'key'=>getNowDate(),'url'=>U(CONTROLLER_NAME.'/'.ACTION_NAME,$GetData),'menu'=>"推广员-推广员管理-游戏分成比例模板-导出"]); + + data2csv($dbres,'游戏分成比例模板',array( + "game_type_name"=>"游戏类型", + "relation_game_name"=>"现包名", + "original_package_name"=>"原包名", + "company_belong"=>"公司类型", + "turnover_ratio_str"=>"比例分成", + "create_time"=>"时间", + "admin_name"=>"操作人" + )); + } + $count = $this->DBModel->alias('m')->field("count(id) count")->join("LEFT JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")->where($where)->find()['count']; $this->assign('data', $dbres); $page = set_pagination($count, $row); @@ -94,7 +118,7 @@ class GameRatioMouldController extends AdminController } //保存 $id = $this->DBModel->add($save); - addOperationLog(['op_type'=>1,'key'=>$id,'op_name'=>'新增游戏分成比例模板','url'=>U('GameRatioMould/index')]); + addOperationLog(['op_type'=>0,'key'=>$id,'op_name'=>'新增游戏分成比例模板','url'=>U('GameRatioMould/index')]); $this->ajaxReturn(["msg"=>"添加成功","code"=>1,"url"=>U("index")]); } else { $game_type = M("game_type","tab_")->field("id,type_name")->where("status=1")->select(); @@ -117,7 +141,7 @@ class GameRatioMouldController extends AdminController $save['turnover_ratio'] = $this->setTurnoverRatio($params); $this->DBModel->save($save); - addOperationLog(['op_type'=>2,'key'=>$save['id'],'op_name'=>'修改游戏分成比例模板','url'=>U('PromoteGameRatio/index')]); + addOperationLog(['op_type'=>1,'key'=>$save['id'],'op_name'=>'修改游戏分成比例模板','url'=>U('PromoteGameRatio/index')]); $this->ajaxReturn(["msg"=>"修改成功","code"=>1,"url"=>U("index")]); } else { $params = I('get.'); @@ -132,6 +156,21 @@ class GameRatioMouldController 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('PromoteGameRatio/index')]); + + $this->ajaxReturn(["msg"=>"删除成功","code"=>1,"url"=>U("index")]); + }else{ + $this->error('删除错误'); + } + } //基础信息获取 public function getGames() { diff --git a/Application/Admin/View/GameRatioMould/index.html b/Application/Admin/View/GameRatioMould/index.html index 09c118862..080fe6302 100644 --- a/Application/Admin/View/GameRatioMould/index.html +++ b/Application/Admin/View/GameRatioMould/index.html @@ -70,7 +70,7 @@
游戏类型 - 现包名 - 原包名 - 公司类型 - 比例分成 - 时间 - 操作人 - 操作 @@ -138,22 +131,17 @@ {$data.game_type_name} {$data.relation_game_name} {$data.original_package_name} - - 下游{$data.company_belong} - + {$data.company_belong}
{$data.turnover_ratio_str}
- {$data.create_time} - {$data.admin_name} - 修改 - 删除 + 删除 @@ -218,124 +206,28 @@ $(function(){ $("#search").click(); } }); -}) - -function refuse() { - if ($('.ids[type=checkbox]:checked').length > 0) { - layer.open({ - type: 1, - title: '审核拒绝', - shadeClose: true, - shade: 0.8, - area: ['387px', '500px'], - content: $('.promote-layer') - }); - $('#deny').addClass('promote-show'); - $('#remark').addClass('ids'); - } else { - updateAlert('请选择需要操作的数据','tip_error'); - setTimeout(function(){ - $('#tip').find('.tipclose').click(); - },1500); - } -} - - +