diff --git a/Application/Admin/Controller/CompanyGameRatioController.class.php b/Application/Admin/Controller/CompanyGameRatioController.class.php index 4d325d7ce..e8045a438 100644 --- a/Application/Admin/Controller/CompanyGameRatioController.class.php +++ b/Application/Admin/Controller/CompanyGameRatioController.class.php @@ -20,8 +20,96 @@ class CompanyGameRatioController extends AdminController $this->DBModel = M("company_game_ratio","tab_"); parent::_initialize(); } - public function index() + { + $params = I('get.'); + $page = $params['p'] ? intval($params['p']) : 1; + $row = $params['row'] ? intval($params['row']) : 10; + //权限分配 + if(!IS_ROOT){ + $this->OpAuthList= getModuleControllerAuth(); + } + + $gamewhere['_string'] = '1 = 1'; + $where['_string'] = '1 = 1'; + if(isset($params['relation_game_id'])){ + $gamewhere['relation_game_id'] = $params['relation_game_id']; + $where['m.relation_game_id'] = $params['relation_game_id']; + } + if(isset($params['company_id'])){ + $where['m.company_id'] = $params['company_id']; + } + $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 = M("company_game_ratio","tab_") + ->alias('m') + ->field("m.*,g.*,p.company_name,p.company_belong") + ->join("left JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id") + ->join("left JOIN tab_promote_company p ON m.company_id = p.id") + ->where($where); + if(isset($params['export'])){ + $dbres = $dbres->select(); + }else{ + $dbres = $dbres->page($page, $row)->select(); + } + foreach($dbres as $k=>&$v){ + $v['settlement_type'] ='--'; + $v['begin_time'] = date("Y-m-d",$v['begin_time']); + $v['end_time'] = $v['end_time'] ? date('Y-m-d', $v['end_time']) : '永久'; + + $v["valid"] = "{$v['begin_time']} ~ {$v['end_time']}"; + + $v['company_belong'] ="下游".getCompanyBlong($v['company_belong']); + if (isset($params['export'])) { + $symbol = "\n"; + } else { + $symbol = "
"; + } + //新 + $thisTurnoverRatios = $v['turnover_ratio'] ? json_decode($v['turnover_ratio'], true) : []; + $thisRatioDtl = "默认:{$v['ratio']}%"; + if ($thisTurnoverRatios) { + + foreach ($thisTurnoverRatios as $thisTurnoverRatio) { + $thisIntervalClosedStatusText = isset($thisTurnoverRatio['instanceof']) ? ($thisTurnoverRatio['instanceof'] == 1 ? '≥' : '>') : '≥'; + $thisRatioDtl .= "{$symbol}月流水{$thisIntervalClosedStatusText}{$thisTurnoverRatio['turnover']},比例:{$thisTurnoverRatio['ratio']}%"; + } + } + $v['turnover_ratio_str'] = $thisRatioDtl; + $v['oplist'] = $this->OpAuth($v); + } + if(isset($_REQUEST['export'])){ + $GetData = $_GET; + unset($GetData['export']); + addOperationLog(['op_type'=>3,'key'=>getNowDate(),"op_name"=>"导出",'url'=>U(CONTROLLER_NAME.'/'.ACTION_NAME,$GetData)]); + + data2csv($dbres,'推广游戏分成管理',array( + "company_name"=>"公司名称", + "company_belong"=>"内外团", + "settlement_type"=>"结算周期", + "game_type_name"=>"游戏类型", + "original_package_name"=>"原游戏名称", + "relation_game_name"=>"现游戏名称", + "valid"=>"生效时间", + "turnover_ratio_str"=>"分成比例" + )); + } + + $count = M("company_game_ratio","tab_")->alias('m')->field("count(id) count")->where($where)->find()['count']; + $this->assign('data', $dbres); + $page = set_pagination($count, $row); + if($page) { + $this->assign('_page', $page); + } + + $this->assign("companyList",D("PromoteCompany")->getList()); + $this->assign("gameList",D("Game")->getRelationGameLits()); + $this->display(); + dd( $dbres); + } + + public function lists() { $params = I('get.'); $page = $params['p'] ? intval($params['p']) : 1; @@ -43,7 +131,7 @@ class CompanyGameRatioController extends AdminController if(isset($params['status'])){ $where['m.status'] = $params['status']; } - //TODO:未计算公司类型,未进行排序 + //TODO:未计算公司类型 $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 = M("company_game_ratio_log","tab_") @@ -156,6 +244,8 @@ class CompanyGameRatioController extends AdminController $this->assign("gameList",D("Game")->getRelationGameLits()); $this->display(); } + + public function marketAgree(){ if(!isset($_REQUEST['ids'])) $this->error("参数错误"); @@ -369,6 +459,20 @@ class CompanyGameRatioController extends AdminController } $id = $_REQUEST['id']; $res = M("company_game_ratio_log","tab_")->where("id='{$id}'")->delete(); + if($res !== false){ + addOperationLog(['op_type'=>2,'key'=>$id,'op_name'=>'删除','url'=>U('lists')]); + $this->ajaxReturn(["msg"=>"删除成功","code"=>1,"url"=>U("lists")]); + }else{ + $this->error('删除错误'); + } + } + public function delGameRatio() + { + if(!isset($_REQUEST['id'])){ + $this->error('参数错误'); + } + $id = $_REQUEST['id']; + $res = M("company_game_ratio","tab_")->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")]); @@ -376,6 +480,7 @@ class CompanyGameRatioController extends AdminController $this->error('删除错误'); } } + public function menuAuth() { $addurl = U("addRatio"); @@ -405,14 +510,19 @@ class CompanyGameRatioController extends AdminController $opBtn = [ "editRatio"=>"编辑", "delRatio"=>"删除", + "delGameRatio"=>"删除", ]; //操作对应菜单 - - if($info['status'] == 2){ - $optist = []; + if(!isset($info['status'])){ + $optist = ["delGameRatio"]; }else{ - $optist = ["editRatio","delRatio"]; + if($info['status'] == 2){ + $optist = []; + }else{ + $optist = ["editRatio","delRatio"]; + } } + // $resarr = []; foreach ($optist as $k => $v) { @@ -427,6 +537,8 @@ class CompanyGameRatioController extends AdminController return $resarr; } + + public function setTurnoverRatio($params) { $save['turnover_ratio'] = []; diff --git a/Application/Admin/View/CompanyGameRatio/index.html b/Application/Admin/View/CompanyGameRatio/index.html index e65d04238..8fe2cfa50 100644 --- a/Application/Admin/View/CompanyGameRatio/index.html +++ b/Application/Admin/View/CompanyGameRatio/index.html @@ -52,8 +52,12 @@
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+ 搜索 +
+
+ +
+
+
+ + {$vo} + +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 公司名称内外团结算周期游戏类型原游戏名称现游戏名称生效时间原比例申请比例创建记录市场部审批管理员审批备注操作
aOh! 暂时还没有内容!
+ + {$data.company_name}{$data.company_belong}{$data.settlement_type}{$data.game_type_name}{$data.original_package_name}{$data.relation_game_name}{$data.valid} +
+ {$data.last_turnover_ratio_str} +
+
+
+ {$data.turnover_ratio_str} +
+
+
+ {$data.create} +
+
+ + +
+ {$data.market} +
+ +
+ {$data.market} +
+
+
+ +
+ {$data.admin} +
+ +
+ {$data.admin} +
+
+
+ {$data.remark} + + + {$vo} + +
+
+ +
+ +
+ + 导出 + + {$_page|default=''} +
+ +
+
+
    +
  1. +
    + 备注: + +
    +
    拒绝
    +
  2. +
+
+
+ + + + + + +