diff --git a/Application/Admin/Controller/AdminController.class.php b/Application/Admin/Controller/AdminController.class.php index 19d9b938c..816546c66 100644 --- a/Application/Admin/Controller/AdminController.class.php +++ b/Application/Admin/Controller/AdminController.class.php @@ -52,7 +52,7 @@ class AdminController extends Controller { if(!in_array(CONTROLLER_NAME, $access_controller)){//ajax放行 //检测访问权限 $rule = strtolower(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME); - if($rule == "admin/statistics/overview"){//第一级菜单单独判断 + if($rule == "admin/statistics/overview"||$rule == "admin/spend/lists"){//第一级菜单单独判断 $this->strictCheckRule($rule); diff --git a/Application/Admin/Controller/FinancePromoteController.class.php b/Application/Admin/Controller/FinancePromoteController.class.php index e455f2eae..b14d030a7 100644 --- a/Application/Admin/Controller/FinancePromoteController.class.php +++ b/Application/Admin/Controller/FinancePromoteController.class.php @@ -45,7 +45,6 @@ class FinancePromoteController extends AdminController $senddata[$v['p_id']] = $v; } -// dump($cash);die(); //内冲 $inside = self::getJoinPromoteData([],$istimeselect,"promote_coin"); foreach($inside as $k=>$v){ @@ -109,7 +108,6 @@ class FinancePromoteController extends AdminController "bind_coin_count"=>0, "inside_cash_count"=>0, ); -// dump($senddata);die(); foreach($senddata as $k=>$v){ if ($v['company_belong']==1) { $v['company_belong']='外团'; @@ -152,7 +150,6 @@ class FinancePromoteController extends AdminController $outBelong = 0; $insideBelong = 0; -// dump($data);die(); foreach ($data as $key => $value) { if ($value['company_belong']=='外团') { @@ -174,7 +171,6 @@ class FinancePromoteController extends AdminController $this->assign('all_count', $count); $this->meta_title = '公会统计'; $this->display(); - # code... } private function getJoinPromoteData($map,$istimeselect,$type="spend") { @@ -264,12 +260,17 @@ class FinancePromoteController extends AdminController } $senddata = []; //获取各会长的现金充值 - $cash = self::promoteUserData([],$istimeselect); + $map=[]; + $title = ''; + self::setPromoteMap($map,"s.promote_id",$title); + $title .= "渠道统计"; + $this->assign('title', $title); + $cash = self::promoteUserData($map,$istimeselect); foreach($cash as $k=>$v){ $senddata[$v['promote_id']] = $v; } - $inside = self::promoteUserData([],$istimeselect,"promote_coin"); + $inside = self::promoteUserData($map,$istimeselect,"promote_coin"); foreach($inside as $k=>$v){ if(array_key_exists($v['promote_id'],$senddata)){ @@ -280,19 +281,11 @@ class FinancePromoteController extends AdminController $senddata[$v['promote_id']] = $v; }; } - if(!empty($senddata)){ - if(array_key_exists(0,$senddata) || $_REQUEST['promote_id']==0){ - $pmap['status']=1; - if($istimeselect){ - $pmap['create_time'] = $istimeselect; - } - $admininside = M("provide_user p","tab_")->field("sum(amount) amount")->where($pmap)->find(); - if($admininside['amount'] >0){ - $senddata[0]['inside_cash_count']= $admininside['amount']; - } - - } + + if(array_key_exists(0,$senddata)){ + unset($senddata[0]); } + $count = count($senddata); if ($_REQUEST['data_order'] != '') { $data_order = reset(explode(',', $_REQUEST['data_order'])); @@ -354,17 +347,6 @@ class FinancePromoteController extends AdminController } private function promoteUserData($map,$istimeselect,$type="spend") { - // setPowerPromoteIds($map,"s.promote_id"); - if ($_REQUEST['promote_id'] != '') { - if ($_REQUEST['promote_id'] == 0) { - $map['s.promote_id'] = 0; - } else { - $promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select(); - if ($promoter_ids) { - $map['s.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))]; - } - } - } if (isset($_REQUEST['company_id'])) { $map['promote.company_id'] = $_REQUEST['company_id']; } @@ -376,6 +358,7 @@ class FinancePromoteController extends AdminController $map['s.pay_time']=$istimeselect; } $map['s.pay_status']=1; + // dd($map); $field= "SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count, SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count, SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as bind_coin_count, @@ -404,7 +387,6 @@ class FinancePromoteController extends AdminController ->group('promote_id') ->select(); } - # code... } /** *游戏统计 @@ -413,7 +395,6 @@ class FinancePromoteController extends AdminController $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 $row = $_REQUEST['row'] ?? 10; - $map = []; if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) { $map["s.game_id"] = array("in",implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) ); @@ -429,23 +410,13 @@ class FinancePromoteController extends AdminController } elseif (isset($_REQUEST['time_end'])) { $map['s.pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399]; } - //判断是否有推广员 - $level = 1; - if ($_REQUEST['promote_id'] != '') { - if ($_REQUEST['promote_id'] != 0){ - $level = M('promote', 'tab_')->field('level')->where(array('id' => $_REQUEST['promote_id']))->find()['level']; - } - if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) { - $map['s.promote_id'] = $_REQUEST['promote_id']; - } else { - $promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select(); - if ($promoter_ids) { - $map['s.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))]; - } - } - } - $this->assign('promote_level', $level); + //获取推广员 + $title = ''; + self::setPromoteMap($map,"s.promote_id",$title); + $title .= "游戏统计"; + $this->assign('title', $title); + //游戏统计列表 $data =self::gameStatisticsData($map, $row, $p); if(isset($_REQUEST['export'])){ @@ -462,7 +433,7 @@ class FinancePromoteController extends AdminController if(!$value['game_name']) $value['game_name'] = "无"; } if (isset($_REQUEST['export'])) { - data2csv($data,'游戏统计', array( + data2csv($data,$title, array( "partner_name"=>"合作公司", "game_name"=>"游戏", "cash_count"=>"游戏现金金额", @@ -530,33 +501,16 @@ class FinancePromoteController extends AdminController } elseif (isset($_REQUEST['time_end'])) { $map['pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399]; } - - //判断是否有推广员 - if ($_REQUEST['promote_id'] != '') { - if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) { - $map['promote_id'] = $_REQUEST['promote_id']; - } else { - $promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select(); - if ($promoter_ids) { - $map['promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))]; - } - } - } - - if (!empty(I("root_id"))) { - $root_id = I("root_id"); - $promote_id = $this->getPromoteList($root_id); - array_push($promote_id, $root_id); - } - - if ($_REQUEST['root_id']=='0') { - $map['promote_id'] = $_REQUEST['root_id']; + //获取推广员 + $title = ''; + self::setPromoteMap($map,"promote_id",$title); + if (isset($_REQUEST['game_name'])){ + $title .= ($_REQUEST['game_name']."-"); } + $title .= "游戏订单查看"; + $this->assign('title', $title); + - $promote_id = implode(',',$promote_id); - if ($promote_id) { - $map['promote_id'] = ['in',$promote_id]; - } $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 @@ -587,7 +541,7 @@ class FinancePromoteController extends AdminController $data[$key]['pay_way'] = getPayType($value['pay_way']); } if (isset($_REQUEST['export'])) { - data2csv($data,'游戏订单查看', array( + data2csv($data,$title, array( "pay_order_number"=>"支付订单号", "pay_time"=>"充值时间", "user_account"=>"玩家账号", @@ -925,5 +879,68 @@ class FinancePromoteController extends AdminController $this->display(); } - + private function setPromoteMap(&$map,$field,&$title) + { + //公司判断 + $pmap = false; //非特意推广员检索 + $gfflg = true; //是否有官方 + if (isset($_REQUEST['company_id'])) { + $pmap['company_id'] = $_REQUEST['company_id']; + //获取公司名称 + if($pmap['company_id'] == 0){ + $title .= "万盟天下科技-"; + }else{ + $gfflg = false; + $title .= (M('promote_company',"tab_")->field("company_name")->where("id = '{$pmap['company_id']}'")->find()['company_name'] . "-"); + } + + } + if (isset($_REQUEST['company_belong'])) { + $pmap['company_belong'] = $_REQUEST['company_belong']; + if($_REQUEST['company_belong'] == 0){ + $title .= "内团-"; + }else{ + $gfflg = false; + $title .= "外团-"; + } + } + if (isset($_REQUEST['promote_id'])) { + $pmap = false; //取消非特异推广员检索 + $title .= (get_promote_name($_REQUEST['promote_id'])."-"); + if ($_REQUEST['promote_id'] != 0){ + $gfflg = false; + } + } + + if($pmap){ + $promoter_ids = D("Promote")->where($pmap)->field('id')->select(); + if ($promoter_ids) { + if($gfflg){ + $t_in = "0,".implode(',', array_column($promoter_ids, 'id')); + }else{ + $t_in = implode(',', array_column($promoter_ids, 'id')); + } + $map[$field] = ['in',$t_in]; + } + } + + //判断是否有推广员 + $level = 1; + if ($_REQUEST['promote_id'] != '') { + if ($_REQUEST['promote_id'] != 0){ + $level = M('promote', 'tab_')->field('level')->where(array('id' => $_REQUEST['promote_id']))->find()['level']; + } + if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) { + $map[$field] = $_REQUEST['promote_id']; + } else { + $promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select(); + if ($promoter_ids) { + $map[$field] = ['in', implode(',', array_column($promoter_ids, 'id'))]; + } + } + } + // dd($map); + $_POST['promote_level'] = $level; + } + } \ No newline at end of file diff --git a/Application/Admin/View/FinancePromote/gameStatistics.html b/Application/Admin/View/FinancePromote/gameStatistics.html index 3ae3429f6..ab804df9f 100644 --- a/Application/Admin/View/FinancePromote/gameStatistics.html +++ b/Application/Admin/View/FinancePromote/gameStatistics.html @@ -72,10 +72,7 @@