From 8d934c8d881fa033028b7149a819c93d027e47a4 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Mon, 23 Dec 2019 16:35:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/StatController.class.php | 54 ++- .../Admin/View/Stat/userretention.html | 45 ++- .../Admin/View/Stat/userretention1.html | 338 ++++++++++++++++++ Data/update.sql | 4 +- 4 files changed, 416 insertions(+), 25 deletions(-) create mode 100644 Application/Admin/View/Stat/userretention1.html diff --git a/Application/Admin/Controller/StatController.class.php b/Application/Admin/Controller/StatController.class.php index 163fe452a..7310b44c5 100644 --- a/Application/Admin/Controller/StatController.class.php +++ b/Application/Admin/Controller/StatController.class.php @@ -5,6 +5,7 @@ use Admin\Model\SpendModel; use Open\Model\UserLoginRecordModel; use Admin\Model\UserPlayModel; use User\Api\UserApi as UserApi; +use GuzzleHttp\Client; /** * 后台首页控制器 @@ -115,13 +116,64 @@ class StatController extends ThinkController } + public function userretention() + { + $this->meta_title = '留存统计'; + $start = I('start', date('Y-m-d',strtotime('-7 day'))); + $end = empty(I('end')) ? time_format(time(),'Y-m-d') : I('end'); + $gameId = I('game_id', 0); + + $status = true; + $data = false; + $error = ''; + if ($gameId == 0) { + $error = '请选择游戏!'; + $status = false; + } + $startTime = strtotime($start . ' 00:00:00'); + $endTime = strtotime($end . ' 23:59:59') + 1; + if ((($endTime - $startTime)/(24*3600)) > 31) { + $error = '时间间隔不能超过31天'; + $status = false; + } + if ($status) { + $client = new Client([ + 'base_uri' => C('PACKAGE_SERVER_URL'), + 'timeout' => 10.0, + ]); + $response = $client->post('/statistics/player-retention', [ + 'verify' => false, + 'form_params' => [ + 'start_time' => $start, + 'end_time' => $end, + 'promote_id' => I('promote_id', 0), + 'game_id' => $gameId, + ] + ]); + + $result = (string)$response->getBody(); + $result = json_decode($result, true); + if (!$result) { + $this->assign('error', '数据请求异常!'); + } + $data = $result['data']['records']; + } else { + $this->assign('error', $error); + } + + $this->assign('data', $data); + $this->meta_title = '留存统计'; + $this->display(); + } + + /** * 留存统计 * @param int $p * 06.12.3 * xmy */ - public function userretention($p = 0) + public function playerRetention($p = 0) { echo "暂不开放"; die(); diff --git a/Application/Admin/View/Stat/userretention.html b/Application/Admin/View/Stat/userretention.html index 2a4cdc821..b6ab5e513 100644 --- a/Application/Admin/View/Stat/userretention.html +++ b/Application/Admin/View/Stat/userretention.html @@ -86,7 +86,7 @@
说明:根据日期,游戏,推广员分析用户留存率信息
+日期 | + +游戏名称 | +渠道名称 | +新增玩家 | + +1日留存 | + +2日留存 | + +3日留存 | + +4日留存 | + +5日留存 | + +6日留存 | + +7日留存 | + +15日留存 | + +30日留存 | +
---|---|---|---|---|---|---|---|---|---|---|---|---|
aOh! 暂时还没有内容! | +||||||||||||
{$vo.time} | +{$game_name} | +{$promote_name} | +{$vo.register_num} | +{:round($vo['1']/$vo['register_num'],4)*100}% | +{:round($vo['2']/$vo['register_num'],4)*100}% | +{:round($vo['3']/$vo['register_num'],4)*100}% | +{:round($vo['4']/$vo['register_num'],4)*100}% | +{:round($vo['5']/$vo['register_num'],4)*100}% | +{:round($vo['6']/$vo['register_num'],4)*100}% | +{:round($vo['7']/$vo['register_num'],4)*100}% | +{:round($vo['15']/$vo['register_num'],4)*100}% | +{:round($vo['30']/$vo['register_num'],4)*100}% | +