From 7f6730a562382691ba38c0de1ab412b134f9d07a Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 26 Dec 2019 11:55:49 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=95=99=E5=AD=98?= =?UTF-8?q?=E7=8E=87bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ExportController.class.php | 87 ++++++++++++++++++- .../Admin/Controller/StatController.class.php | 47 ++++++++-- .../Admin/View/Stat/userretention.html | 60 ++++++------- 3 files changed, 152 insertions(+), 42 deletions(-) diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 11020033b..dadd68150 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -2,6 +2,7 @@ namespace Admin\Controller; use Think\Controller; +use GuzzleHttp\Client; class ExportController extends Controller { @@ -3029,7 +3030,91 @@ class ExportController extends Controller return $total; } - public function userretention_export($p = 0) + public function userretention_export() + { + $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); + $promoteId = I('promote_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->error('数据请求异常!'); + } + $gameName = get_game_name($gameId); + $promoteName = '全部'; + if ($promoteId) { + $promoteName = get_promote_account($promoteId); + } + $data = $result['data']['records']; + $dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30]; + foreach ($data as $key => $item) { + $item['game_name'] = $gameName; + $item['promote_name'] = $promoteName; + foreach ($dayList as $day) { + if ($item['register_count'] > 0) { + $item['retention_day'. $day] = round($item['retention_day'. $day]/$item['register_count'], 4)*100; + } else { + $item['retention_day'. $day] = '--'; + } + } + $data[$key] = $item; + } + } else { + $this->error($error); + } + + $xlsCell = [ + ['date', "日期"], + ['game_name', "游戏名称"], + ['promote_name', "推广员账号"], + ['register_count', '新增玩家', 'time_format', '*'], + ['retention_day1', '1日留存', 'time_format', '*'], + ['retention_day2', '2日留存'], + ['retention_day3', "3日留存"], + ['retention_day4', '4日留存'], + ['retention_day5', '5日留存'], + ['retention_day6', '6日留存'], + ['retention_day7', '7日留存'], + ['retention_day15', '15日留存'], + ['retention_day30', '30日留存'], + ]; + $xlsData = $data; + $xlsName = $_REQUEST['xlsname']?$_REQUEST['xlsname']:'留存分析'; + $this->exportExcel($xlsName, $xlsCell, $xlsData); + } + + public function userretention($p = 0) { $request=$_REQUEST; $page = intval($p); diff --git a/Application/Admin/Controller/StatController.class.php b/Application/Admin/Controller/StatController.class.php index f5d287b7b..d1c7bc370 100644 --- a/Application/Admin/Controller/StatController.class.php +++ b/Application/Admin/Controller/StatController.class.php @@ -118,14 +118,25 @@ class StatController extends ThinkController public function multisort($records, $column, $type = 'asc') { - $records = index_by_column($column, $records); - // var_dump($records);die(); - if ($type == 'asc') { - ksort($records); - } else { - krsort($records); + $length = count($records); + for ($i = 0; $i < $length; $i ++) { + for ($j = $i + 1; $j < $length; $j ++) { + if ($type == 'asc') { + if ($records[$i][$column] > $records[$j][$column]) { + $temp = $records[$i]; + $records[$i] = $records[$j]; + $records[$j] = $temp; + } + } else if ($type == 'desc') { + if ($records[$i][$column] < $records[$j][$column]) { + $temp = $records[$i]; + $records[$i] = $records[$j]; + $records[$j] = $temp; + } + } + } } - return array_values($records); + return $records; } public function userretention() @@ -135,6 +146,16 @@ class StatController extends ThinkController $end = empty(I('end')) ? time_format(time(),'Y-m-d') : I('end'); $dataOrder = I('data_order', ''); $gameId = I('game_id', 0); + $promoteId = I('promote_id', 0); + + $orderType = 'asc'; + $orderColumn = 'date'; + if ($dataOrder != '') + { + $dataOrder = explode(',', $dataOrder); + $orderType = $dataOrder[1]; + $orderColumn = $dataOrder[0]; + } $status = true; $data = false; @@ -171,7 +192,14 @@ class StatController extends ThinkController } $data = $result['data']['records']; $dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30]; + $gameName = get_game_name($gameId); + $promoteName = '全部'; + if ($promoteId) { + $promoteName = get_promote_account($promoteId); + } foreach ($data as $key => $item) { + $item['promote_name'] = $promoteName; + $item['game_name'] = $gameName; foreach ($dayList as $day) { if ($item['register_count'] > 0) { $item['retention_day'. $day] = round($item['retention_day'. $day]/$item['register_count'], 4)*100; @@ -182,12 +210,15 @@ class StatController extends ThinkController $data[$key] = $item; } if ($dataOrder) { - $data = $this->multisort($data, $dataOrder); + $data = $this->multisort($data, $orderColumn, $orderType); } } else { $this->assign('error', $error); } + $this->assign('data', $data); + $this->assign('order_type', $orderType); + $this->assign('order_column', $orderColumn); $this->assign('data', $data); $this->meta_title = '留存统计'; $this->display(); diff --git a/Application/Admin/View/Stat/userretention.html b/Application/Admin/View/Stat/userretention.html index 890749641..1c3cf81e0 100644 --- a/Application/Admin/View/Stat/userretention.html +++ b/Application/Admin/View/Stat/userretention.html @@ -70,59 +70,47 @@
+ ';?> - + + + + - - + - - - - - - - - - - - - + - + - + - + - + - + - + - + - + - - - - - - + + 0):?> @@ -229,10 +217,16 @@ $(function(){ $(".paixu").click(function(){ var that=$(this); $data_order=that.attr('data-order'); - $order_type='{$userarpu_order}'; - $(".sortBy").attr('name','data_order'); - $(".sortBy").attr('value',$data_order); - $("#search").click(); + $order_type='{$order_type}'; + if ($order_type == '' || $order_type == 'asc') { + $(".sortBy").attr('name', 'data_order'); + $(".sortBy").attr('value', $data_order + ',desc'); + $("#search").click(); + } else if ($order_type=='desc') { + $(".sortBy").attr('name', 'data_order'); + $(".sortBy").attr('value', $data_order + ',asc'); + $("#search").click(); + } }); //回车自动提交 $('.jssearch').find('input').keyup(function(event){ From ea15b6427c9ef77e59ea35ea7e85624bfc8f58a1 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 26 Dec 2019 12:14:31 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=90=BD=E5=9C=B0?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/ExportController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index dadd68150..8205764a9 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -3083,7 +3083,7 @@ class ExportController extends Controller $item['promote_name'] = $promoteName; foreach ($dayList as $day) { if ($item['register_count'] > 0) { - $item['retention_day'. $day] = round($item['retention_day'. $day]/$item['register_count'], 4)*100; + $item['retention_day'. $day] = (round($item['retention_day'. $day]/$item['register_count'], 4)*100) . '%'; } else { $item['retention_day'. $day] = '--'; } From bfd8d2d6f4881c7add5c14bbabf992adbd29f2aa Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 26 Dec 2019 13:46:44 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/CommonController.class.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Application/Mobile/Controller/CommonController.class.php b/Application/Mobile/Controller/CommonController.class.php index 99aba36d5..4127a0153 100644 --- a/Application/Mobile/Controller/CommonController.class.php +++ b/Application/Mobile/Controller/CommonController.class.php @@ -133,10 +133,10 @@ class CommonController extends BaseController { $this->respondError('用户不存在'); } //更新用户 - $upres = $userApi->updatePassword($userInfo['id'], $user['password']); + $upres = $userApi->updatePassword($userInfo['id'], $params['password']); if($upres){ //自动登陆 - $userId = $userApi->login($user['account'], $user['password'],1); + // $userId = $userApi->login($params['account'], $params['password'], 1); $this->respondSuccess('修改成功'); }else{ @@ -180,18 +180,18 @@ class CommonController extends BaseController { } $data = [ - 'account' => $account, - 'password' => think_ucenter_md5($password, UC_AUTH_KEY), - 'phone' => $phone, - 'head_img' =>'', + 'account' => $account, + 'password' => think_ucenter_md5($password, UC_AUTH_KEY), + 'phone' => $phone, + 'head_img' => '', 'promote_id' => $promote_id, - 'promote_account' =>get_promote_account($promote_id), + 'promote_account' => get_promote_account($promote_id), 'register_way' => $register_way, 'register_type' => $register_type, - 'register_ip' => get_client_ip(), - 'parent_id'=>get_fu_id($promote_id), - 'parent_name'=>get_parent_name($promote_id), - 'register_time'=>time(), + 'register_ip' => get_client_ip(), + 'parent_id' => get_fu_id($promote_id), + 'parent_name' => get_parent_name($promote_id), + 'register_time' => time(), 'check_time' => time(), ]; From 31723fbc0bd29b9243a4ae0d5a372b6b22dcd709 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 26 Dec 2019 13:54:55 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/Controller/PromoteController.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index 36edd4cc4..6b6d5ead8 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -985,6 +985,9 @@ class PromoteController extends BaseController } else { $parent = $loginPromote; } + if (C('PROMOTE_AUTO_AUDIT') == 1) { + $params['status'] = 1; + } $promoteService = new PromoteService(); $result = $promoteService->checkAddPromote($params); if (!$result['status']) { From 931893640a3c3c87de3c2744d387677b503e61ab Mon Sep 17 00:00:00 2001 From: yulingwei <2436953959@qq.com> Date: Thu, 26 Dec 2019 15:07:26 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/GameController.class.php | 4 ++-- Application/Admin/View/Game/edit.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Application/Admin/Controller/GameController.class.php b/Application/Admin/Controller/GameController.class.php index 0f5e8e217..842b87773 100644 --- a/Application/Admin/Controller/GameController.class.php +++ b/Application/Admin/Controller/GameController.class.php @@ -298,8 +298,8 @@ class GameController extends ThinkController $this->error('一句话简介不能超过30个字!'); exit; } - if (!preg_match("/^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+/i", $_POST['beta_url'])) { - return $this->error("请填写正确的Bata链接"); + if (!empty($_POST['beta_url']) && !preg_match("/^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+/i", $_POST['beta_url'])) { + return $this->error("请填写正确的Beta链接"); } /*if($_POST['apply_status']==0&&$_POST['game_status']==1){ $this->error('游戏未审核不允许显示');//游戏添加完成 diff --git a/Application/Admin/View/Game/edit.html b/Application/Admin/View/Game/edit.html index f3ff9f62d..a11cf4ce7 100644 --- a/Application/Admin/View/Game/edit.html +++ b/Application/Admin/View/Game/edit.html @@ -430,14 +430,14 @@ - + - +
日期日期 游戏名称渠道名称新增玩家 1日留存 游戏名称渠道名称新增玩家1日留存2日留存2日留存 3日留存3日留存 4日留存4日留存 5日留存5日留存 6日留存6日留存 7日留存7日留存 15日留存15日留存 30日留存30日留存
' . $error . '': 'aOh! 暂时还没有内容!' ?>' . $error . '': 'aOh! 暂时还没有内容!' ?>
{$vo.date}{$game_name}{$promote_name}{$vo.game_name}{$vo.promote_name} {$vo.register_count} {$vo['retention_day1']}%
Bata版本链接:Beta版本链接:
Bata版本是否开启Beta版本是否开启