|
|
@ -6,6 +6,7 @@ class CompanyGameRatioController extends AdminController
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public $admininfo;
|
|
|
|
public $admininfo;
|
|
|
|
public $DBModel;
|
|
|
|
public $DBModel;
|
|
|
|
|
|
|
|
public $OpAuthList=[];
|
|
|
|
public $Status = [
|
|
|
|
public $Status = [
|
|
|
|
"-2"=>"管理员拒绝",
|
|
|
|
"-2"=>"管理员拒绝",
|
|
|
|
"-1"=>"市场部拒绝",
|
|
|
|
"-1"=>"市场部拒绝",
|
|
|
@ -22,11 +23,14 @@ class CompanyGameRatioController extends AdminController
|
|
|
|
|
|
|
|
|
|
|
|
public function index()
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dd(MODULE_NAME."/".CONTROLLER_NAME );
|
|
|
|
|
|
|
|
$params = I('get.');
|
|
|
|
$params = I('get.');
|
|
|
|
$page = $params['p'] ? intval($params['p']) : 1;
|
|
|
|
$page = $params['p'] ? intval($params['p']) : 1;
|
|
|
|
$row = $params['row'] ? intval($params['row']) : 10;
|
|
|
|
$row = $params['row'] ? intval($params['row']) : 10;
|
|
|
|
|
|
|
|
//权限分配
|
|
|
|
|
|
|
|
if(!IS_ROOT){
|
|
|
|
|
|
|
|
$this->OpAuthList= getModuleControllerAuth();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$gamewhere['_string'] = '1 = 1';
|
|
|
|
$gamewhere['_string'] = '1 = 1';
|
|
|
|
$where['_string'] = '1 = 1';
|
|
|
|
$where['_string'] = '1 = 1';
|
|
|
|
if(isset($params['relation_game_id'])){
|
|
|
|
if(isset($params['relation_game_id'])){
|
|
|
@ -39,7 +43,7 @@ class CompanyGameRatioController extends AdminController
|
|
|
|
if(isset($params['status'])){
|
|
|
|
if(isset($params['status'])){
|
|
|
|
$where['m.status'] = $params['status'];
|
|
|
|
$where['m.status'] = $params['status'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//TODO:未计算公司类型
|
|
|
|
//TODO:未计算公司类型,未进行排序
|
|
|
|
$this->checkListOrCountAuthRestMap($where);
|
|
|
|
$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);
|
|
|
|
$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_")
|
|
|
|
$dbres = M("company_game_ratio_log","tab_")
|
|
|
@ -112,6 +116,7 @@ class CompanyGameRatioController extends AdminController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$v['last_turnover_ratio_str'] = $lastRatioDtl;
|
|
|
|
$v['last_turnover_ratio_str'] = $lastRatioDtl;
|
|
|
|
|
|
|
|
$v['oplist'] = $this->OpAuth($v);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$count = M("company_game_ratio_log","tab_")->alias('m')->field("count(id) count")->where($where)->find()['count'];
|
|
|
|
$count = M("company_game_ratio_log","tab_")->alias('m')->field("count(id) count")->where($where)->find()['count'];
|
|
|
@ -122,11 +127,115 @@ class CompanyGameRatioController extends AdminController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->assign('status',$this->Status);
|
|
|
|
$this->assign('status',$this->Status);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assign('menubtn',$this->menuAuth());
|
|
|
|
|
|
|
|
|
|
|
|
$this->assign("companyList",D("PromoteCompany")->getList());
|
|
|
|
$this->assign("companyList",D("PromoteCompany")->getList());
|
|
|
|
$this->assign("gameList",D("Game")->getRelationGameLits());
|
|
|
|
$this->assign("gameList",D("Game")->getRelationGameLits());
|
|
|
|
$this->display();
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function marketAgree(){
|
|
|
|
|
|
|
|
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
|
|
|
|
|
|
|
|
$ids = $_REQUEST['ids'];
|
|
|
|
|
|
|
|
$company_game_ratio_log = M("company_game_ratio_log","tab_");
|
|
|
|
|
|
|
|
$dbres = $company_game_ratio_log->field("id,status,verify_log")->where("id in ({$ids})")->select();
|
|
|
|
|
|
|
|
foreach($dbres as $k=>&$v){
|
|
|
|
|
|
|
|
if($v['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['status']=1;
|
|
|
|
|
|
|
|
$company_game_ratio_log->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'];
|
|
|
|
|
|
|
|
$company_game_ratio_log = M("company_game_ratio_log","tab_");
|
|
|
|
|
|
|
|
$dbres = $company_game_ratio_log->field("id,status,verify_log")->where("id in ({$ids})")->select();
|
|
|
|
|
|
|
|
foreach($dbres as $k=>&$v){
|
|
|
|
|
|
|
|
if($v['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['status']=-1;
|
|
|
|
|
|
|
|
$company_game_ratio_log->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'];
|
|
|
|
|
|
|
|
$company_game_ratio_log = M("company_game_ratio_log","tab_");
|
|
|
|
|
|
|
|
$dbres = $company_game_ratio_log->field("id,status,verify_log")->where("id in ({$ids})")->select();
|
|
|
|
|
|
|
|
foreach($dbres as $k=>&$v){
|
|
|
|
|
|
|
|
if($v['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['status']=-2;
|
|
|
|
|
|
|
|
$company_game_ratio_log->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'];
|
|
|
|
|
|
|
|
$company_game_ratio_log = M("company_game_ratio_log","tab_");
|
|
|
|
|
|
|
|
$company_game_ratio = M("company_game_ratio","tab_");
|
|
|
|
|
|
|
|
$dbres = $company_game_ratio_log->field("*")->where("id in ({$ids})")->select();
|
|
|
|
|
|
|
|
foreach($dbres as $k=>&$v){
|
|
|
|
|
|
|
|
if($v['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['status']=2;
|
|
|
|
|
|
|
|
$company_game_ratio_log->save($v);
|
|
|
|
|
|
|
|
//保存到其他表
|
|
|
|
|
|
|
|
//查找是否存在
|
|
|
|
|
|
|
|
$ratiov = [
|
|
|
|
|
|
|
|
"company_id"=>$v['company_id'],
|
|
|
|
|
|
|
|
"relation_game_id"=>$v['relation_game_id'],
|
|
|
|
|
|
|
|
"ratio"=>$v['ratio'],
|
|
|
|
|
|
|
|
"turnover_ratio"=>$v['turnover_ratio'],
|
|
|
|
|
|
|
|
"begin_time"=>$v['begin_time'],
|
|
|
|
|
|
|
|
"end_time"=>$v['end_time'],
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$has = $company_game_ratio->where("company_id='{$v['company_id']}' and relation_game_id='{$v['relation_game_id']}'")->find();
|
|
|
|
|
|
|
|
if(isset($has['id'])){
|
|
|
|
|
|
|
|
$ratiov['id'] = $has['id'];
|
|
|
|
|
|
|
|
$company_game_ratio->save($ratiov);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$company_game_ratio->add($ratiov);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"管理员审核",'url'=>U('index')]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->ajaxReturn(array(
|
|
|
|
|
|
|
|
'status' => 1,
|
|
|
|
|
|
|
|
"info"=>"市场部审核通过成功"
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function add()
|
|
|
|
public function add()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ($_POST) {
|
|
|
|
if ($_POST) {
|
|
|
@ -184,6 +293,57 @@ class CompanyGameRatioController extends AdminController
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function menuAuth()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$addurl = U("add");
|
|
|
|
|
|
|
|
$mentBtn = [
|
|
|
|
|
|
|
|
"addRatio"=>"<a class='butn' href='{$addurl}'>新增推广游戏分成</a>",
|
|
|
|
|
|
|
|
"marketAgree"=>"<a class='butn' id='marketAgree'>市场部审批通过</a>",
|
|
|
|
|
|
|
|
"marketRefuse"=>"<a class='butn' id='marketRefuse' style='background-color: red;'>市场部审核拒绝</a>",
|
|
|
|
|
|
|
|
"adminAgree"=>"<a class='butn' id='adminAgree'>管理员审核通过</a>",
|
|
|
|
|
|
|
|
"adminRefuse"=>"<a class='butn' id='marketRefuse' style='background-color: red;'>管理员审核拒绝</a>"
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
$resarr = [];
|
|
|
|
|
|
|
|
foreach ($mentBtn as $k => $v) {
|
|
|
|
|
|
|
|
if(IS_ROOT){
|
|
|
|
|
|
|
|
$resarr[] = $v;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
if(in_array($k,$this->OpAuthList)){
|
|
|
|
|
|
|
|
$resarr[] = $v;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return $resarr;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function OpAuth($info)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$id = $info['id'];
|
|
|
|
|
|
|
|
//原始列表
|
|
|
|
|
|
|
|
$opBtn = [
|
|
|
|
|
|
|
|
"editRatio"=>"<a class='confirm editRatio' data-id='{$id}'>编辑</a>",
|
|
|
|
|
|
|
|
"delRatio"=>"<a class='confirm delRatio' data-id='{$id}' style='color: red;'>删除</a>",
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
//操作对应菜单
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($info['status'] == 2){
|
|
|
|
|
|
|
|
$optist = [];
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
$optist = ["editRatio","delRatio"];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
$resarr = [];
|
|
|
|
|
|
|
|
foreach ($optist as $k => $v) {
|
|
|
|
|
|
|
|
if(IS_ROOT){
|
|
|
|
|
|
|
|
$resarr[] = $opBtn[$v];
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
if(in_array($v,$this->OpAuthList)){
|
|
|
|
|
|
|
|
$resarr[] = $opBtn[$v];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return $resarr;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function setTurnoverRatio($params)
|
|
|
|
public function setTurnoverRatio($params)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$save['turnover_ratio'] = [];
|
|
|
|
$save['turnover_ratio'] = [];
|
|
|
|