diff --git a/Application/Admin/Controller/StatController.class.php b/Application/Admin/Controller/StatController.class.php index 3543c2d9b..fe17da456 100644 --- a/Application/Admin/Controller/StatController.class.php +++ b/Application/Admin/Controller/StatController.class.php @@ -145,7 +145,8 @@ class StatController extends ThinkController $start = I('start', date('Y-m-d',strtotime('-7 day'))); $end = empty(I('end')) ? time_format(time(),'Y-m-d') : I('end'); $dataOrder = I('data_order', ''); - $gameId = I('game_id', 0); + $baseGameId = I('game_id', 0); + $deviceType = I('device_type', ''); $promoteId = I('promote_id', 0); $orderType = 'asc'; @@ -160,10 +161,14 @@ class StatController extends ThinkController $status = true; $data = false; $error = ''; - if ($gameId == 0) { + if ($baseGameId == 0) { $error = '请选择游戏!'; $status = false; } + if ($deviceType == '') { + $error = '请选择设备类型!'; + $status = false; + } $startTime = strtotime($start . ' 00:00:00'); $endTime = strtotime($end . ' 23:59:59') + 1; if ((($endTime - $startTime)/(24*3600)) > 31) { @@ -171,6 +176,10 @@ class StatController extends ThinkController $status = false; } if ($status) { + + $baseGame = M('base_game', 'tab_')->where(['id' => $baseGameId])->find(); + $gameId = $deviceType == 'android' ? $baseGame['android_game_id'] : $baseGame['ios_game_id']; + $client = new Client([ 'base_uri' => C('TASK_URL'), 'timeout' => 10.0, @@ -216,7 +225,9 @@ class StatController extends ThinkController $this->assign('error', $error); } - $this->assign('data', $data); + $baseGames = M('base_game', 'tab_')->select(); + + $this->assign('baseGames', $baseGames); $this->assign('order_type', $orderType); $this->assign('order_column', $orderColumn); $this->assign('data', $data); @@ -675,9 +686,10 @@ AND UNIX_TIMESTAMP( { $start = I('start', date('Y-m-d')); $end = I('end', date('Y-m-d')); - $gameIds = I('game_ids', ''); + $baseGameIds = I('game_ids', ''); $promoteId = I('promote_id', 0); $dataOrder = I('data_order', ''); + $deviceType = I('device_type', ''); $containBindCoins = I('contain_bind_coins', 0); $orderType = ''; @@ -697,15 +709,42 @@ AND UNIX_TIMESTAMP( $startTime = strtotime($start . ' 00:00:00'); $endTime = strtotime($end . ' 23:59:59'); - $gameIdRows = $gameIds ? explode(',', $gameIds) : []; - + $baseGameIdRows = $baseGameIds ? explode(',', $baseGameIds) : []; + $baseGames = M('base_game', 'tab_')->select(); + + $gameIds = null; $conditions = []; - if (count($gameIdRows)) { - $conditions['game_id'] = ['in', $gameIdRows]; + if (count($baseGameIdRows)) { + $tmpBaseGames = M('base_game', 'tab_')->where(['id' => ['in', $baseGameIdRows]])->select(); + $gameIds = array_merge(array_column($tmpBaseGames, 'android_game_id'), array_column($tmpBaseGames, 'ios_game_id')); } if (count($promoteIds)) { $conditions['promote_id'] = ['in', $promoteIds]; } + if ($deviceType != '') { + if ($gameIds) { + $gameIds = ( + $deviceType == 'android' ? + array_intersect($gameIds, array_column($baseGames, 'android_game_id')) : + array_intersect($gameIds, array_column($baseGames, 'ios_game_id')) + ); + } else { + $gameIds = ( + $deviceType == 'android' ? + array_column($baseGames, 'android_game_id') : + array_column($baseGames, 'ios_game_id') + ); + } + } + + if ($gameIds && count($gameIds)) { + if (count($gameIds)) { + $conditions['game_id'] = ['in', $gameIds]; + } else { + $conditions['game_id'] = ['in', 0]; + } + } + // 新增用户 /* M('user', 'tab_') @@ -795,6 +834,7 @@ AND UNIX_TIMESTAMP( } $this->meta_title = 'ARPU统计'; + $this->assign('baseGames', $baseGames); $this->assign('records', $rows); $this->assign('order', $order); $this->assign('orderType', $orderType); diff --git a/Application/Admin/View/Stat/userarpu.html b/Application/Admin/View/Stat/userarpu.html index 45e9da560..82a9db2f0 100644 --- a/Application/Admin/View/Stat/userarpu.html +++ b/Application/Admin/View/Stat/userarpu.html @@ -105,9 +105,16 @@
+
+
+
@@ -173,6 +180,7 @@ 'end'=>$_GET['end'], 'game_ids'=>$_GET['game_ids'], 'promote_id'=>$_GET['promote_id'], + 'device_type'=>$_GET['device_type'], 'export'=>1, ),false)}">导出 {$_page|default=''} @@ -187,6 +195,7 @@ Think.setValue('start',"{$Think.get.start|default=''}"); Think.setValue('end',"{$Think.get.end|default=''}"); Think.setValue('promote_id',{$Think.get.promote_id|default='""'}); Think.setValue('game_ids',{$Think.get.game_ids|default='""'}); +Think.setValue('device_type',{$Think.get.device_type|default='""'}); Think.setValue('row',{$Think.get.row|default=10}); $(".select_gallery").select2(); diff --git a/Application/Admin/View/Stat/userretention.html b/Application/Admin/View/Stat/userretention.html index 1c3cf81e0..eae3a6368 100644 --- a/Application/Admin/View/Stat/userretention.html +++ b/Application/Admin/View/Stat/userretention.html @@ -47,10 +47,17 @@
+ + + + +
+
+