From 14fa967f005c3bbcb6809f872e6d11004e11556d Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 2 Jan 2020 17:08:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=A8=E5=B9=BF?= =?UTF-8?q?=E5=91=98=E7=BB=9F=E8=AE=A1=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PlatformController.class.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Application/Admin/Controller/PlatformController.class.php b/Application/Admin/Controller/PlatformController.class.php index dc5d31e2c..849d75939 100644 --- a/Application/Admin/Controller/PlatformController.class.php +++ b/Application/Admin/Controller/PlatformController.class.php @@ -424,15 +424,16 @@ class PlatformController extends ThinkController $map['register_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399]; unset($_REQUEST['timeend']); } - $play_info_map = ''; - + //TODO:应需求,取消玩家表,只要user表的fgame有就算注册无需在play表存在 + $play_map = false; if (isset($_REQUEST['game_name'])) { $map['fgame_name'] = $_REQUEST['game_name']; - $play_info_map .= " and upi.game_name = '{$_REQUEST['game_name']}' "; - unset($_REQUEST['game_name']); + // $play_map = " and up.game_name = '{$_REQUEST['game_name']}' "; } + $play_info_map = false; if (isset($_REQUEST['server_id'])) { - $play_info_map .= " and upi.server_id = '{$_REQUEST['server_id']}' "; + $play_map = false; //有区服就不检索玩家表,有区服一定已经选择游戏了 + $play_info_map = " and upi.server_id = '{$_REQUEST['server_id']}' and upi.game_name = '{$_REQUEST['game_name']}'"; } $today = total(1); @@ -455,11 +456,13 @@ class PlatformController extends ThinkController count(u.id) as count') ->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left') ->join("tab_user as u on tp2.id = u.promote_id", 'left') + ->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false) ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false) ->where($map) ->group('tp1.id') ->order('count desc, register_time') ->select(); + // echo $data;die(); //今日/本周/本月不变 $tmap = $map; if(isset($tmap['register_time'])){ @@ -484,6 +487,7 @@ class PlatformController extends ThinkController count(IF(register_time ' . $mounth . ',1,null)) as mounth') ->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left') ->join("tab_user as u on tp2.id = u.promote_id", 'left') + ->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false) ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false) ->where($tmap) ->group('tp1.id') @@ -529,6 +533,7 @@ class PlatformController extends ThinkController //官方渠道数据添加 $authorityData = M('user', 'tab_')->alias('u') ->field('date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time,count(u.id) as count') + ->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false) ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false) ->where($map) ->find(); @@ -538,6 +543,7 @@ class PlatformController extends ThinkController count(IF(register_time ' . $week . ',1,null)) as week, count(IF(register_time ' . $mounth . ',1,null)) as mounth') ->where($tmap) + ->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false) ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false) ->find(); $authorityData['today'] = $tauthorityData['today']; From 43774e9099a444e3dab530c6c92cc8a9b66ddffc Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 2 Jan 2020 17:34:04 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=91=98=E5=85=85?= =?UTF-8?q?=E5=80=BC=E7=BB=9F=E8=AE=A1=E6=96=B0=E5=A2=9E=E5=AE=98=E6=96=B9?= =?UTF-8?q?=E6=B8=A0=E9=81=93=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PlatformController.class.php | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Application/Admin/Controller/PlatformController.class.php b/Application/Admin/Controller/PlatformController.class.php index 849d75939..fdeba708f 100644 --- a/Application/Admin/Controller/PlatformController.class.php +++ b/Application/Admin/Controller/PlatformController.class.php @@ -699,6 +699,41 @@ class PlatformController extends ThinkController $data[] = $v; } // dd($data); + unset($map['tp1.id']); + unset($map['tp1.chain']); + unset($tmap['tp1.chain']); + unset($tmap['tp1.chain']); + $map['s.promote_id'] = 0; + $tmap['s.promote_id'] = 0; + $authorityData['count'] = 0; + + //如果有官方渠道权限 + $user_auth_promote_ids = session('user_auth_promote_ids'); + if ($user_auth_promote_ids == 'all' || in_array('0', explode(",", $user_auth_promote_ids))) { + //官方渠道数据添加 + $authorityData = M('spend', 'tab_')->alias('s') + ->field('floor(sum(pay_amount)*100) as count') + ->where($map) + ->find(); + $tauthorityData = M('spend', 'tab_')->alias('s') + ->field(' + floor(sum(IF(s.pay_time ' . $today . ',pay_amount,0))*100) as today, + floor(sum(IF(s.pay_time ' . $week . ',pay_amount,0))*100) as week, + floor(sum(IF(s.pay_time ' . $mounth . ',pay_amount,0))*100) as mounth') + ->where($tmap) + ->find(); + $authorityData['today'] = $tauthorityData['today']; + $authorityData['week'] = $tauthorityData['week']; + $authorityData['mounth'] = $tauthorityData['mounth']; + } + $authorityData['promote_account'] = "官方渠道"; + $authorityData['id'] = "1"; + if (isset($_REQUEST['promote_id'])||$authorityData['count']==0) { + $authorityData = []; + } else { + array_push($data, $authorityData); + } + $count = count($data); foreach ($data as $key => $value) { From a37d0d6ec4e21951bda94a0204ff006e2d2519e4 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 2 Jan 2020 17:47:32 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=A8=E5=B9=BF?= =?UTF-8?q?=E5=91=98=E5=85=85=E5=80=BC=E7=BB=9F=E8=AE=A1=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/PlatformController.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Application/Admin/Controller/PlatformController.class.php b/Application/Admin/Controller/PlatformController.class.php index fdeba708f..aa14a7154 100644 --- a/Application/Admin/Controller/PlatformController.class.php +++ b/Application/Admin/Controller/PlatformController.class.php @@ -734,6 +734,9 @@ class PlatformController extends ThinkController array_push($data, $authorityData); } + //数据排序 + $last_names = array_column($data,'count'); + array_multisort($last_names,SORT_DESC,$data); $count = count($data); foreach ($data as $key => $value) {