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日留存 @@ -111,28 +111,28 @@ - aOh! 暂时还没有内容! + ' . $error . '': 'aOh! 暂时还没有内容!' ?> - {$vo.time} + {$vo.date} {$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}% + {$vo.register_count} + {:round($vo['retention_day1']/$vo['register_count'],4)*100}% + {:round($vo['retention_day2']/$vo['register_count'],4)*100}% + {:round($vo['retention_day3']/$vo['register_count'],4)*100}% + {:round($vo['retention_day4']/$vo['register_count'],4)*100}% + {:round($vo['retention_day5']/$vo['register_count'],4)*100}% + {:round($vo['retention_day6']/$vo['register_count'],4)*100}% + {:round($vo['retention_day7']/$vo['register_count'],4)*100}% + {:round($vo['retention_day15']/$vo['register_count'],4)*100}% + {:round($vo['retention_day30']/$vo['register_count'],4)*100}% @@ -141,15 +141,14 @@
- 导出 - {$_page|default=''} + 导出
@@ -169,7 +168,7 @@ $(".select_gallery").select2(); + + + + + + +
+ +
+
+ +
+
+ +  -  + +
+
+ +
+
+ +
+ +
+ 搜索 +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
日期游戏名称渠道名称新增玩家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}%
+
+
+
+ 导出 + {$_page|default=''} +
+ + + + + + +if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + diff --git a/Data/update.sql b/Data/update.sql index 4e720663a..3075a87c6 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -739,4 +739,6 @@ CREATE TABLE `tab_player_retention` ( ALTER TABLE `tab_user_play` ADD COLUMN `create_time` int(11) NOT NULL DEFAULT 0 COMMENT '玩家注册时间'; -update tab_user_play a left join tab_user b on a.user_id= b.id set a.create_time = b.register_time where a.user_id=b.id; \ No newline at end of file +update tab_user_play a left join tab_user b on a.user_id= b.id set a.create_time = b.register_time where a.user_id=b.id; +ALTER TABLE `tab_spend` +ADD COLUMN `event_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '事件是否通知'';