From b27906d470780a3096f704131f28a4cabd21be0c Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Wed, 11 Dec 2019 16:13:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0>=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=AE=A1=E7=90=86>=E5=85=85=E5=80=BC=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6--=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/AutoController.class.php | 61 +++++++++++++++++++ .../Home/Controller/QueryController.class.php | 14 ++++- .../Home/View/default/Home/landingPage2.html | 6 +- .../View/default/Query/userRecharges.html | 24 ++++++++ Data/update.sql | 13 ++++ 5 files changed, 110 insertions(+), 8 deletions(-) diff --git a/Application/Admin/Controller/AutoController.class.php b/Application/Admin/Controller/AutoController.class.php index c704aec94..31037e19a 100644 --- a/Application/Admin/Controller/AutoController.class.php +++ b/Application/Admin/Controller/AutoController.class.php @@ -1034,4 +1034,65 @@ public function auto_rrdae(){ ]; return $ret; } + + //玩家角色每日登录记录 + public function userPlayLoginRecordByDayCount($time = '') + { + if ($time == '') { + $time = strtotime(date('Y-m-d 00:00:00', time() - (3600 * 24))); + } else { + $time = strtotime(date('Y-m-d 00:00:00', strtotime($time))); + } + $res = M('user_play_login_record_by_day', 'tab_')->where(array('create_time' => $time))->find(); + if (empty($res)) { + $map['login_time'] = ['between', [$time, strtotime(date('Y-m-d 23:59:59', $time))]]; + + $this->userPlayLoginRecordByDayByMap($map); + } + } + + //玩家角色每日登录记录--初始化 + public function userPlayLoginRecordByDayInitial() + { + $res = M('user_play_login_record_by_day', 'tab_')->order('id asc')->find(); + if (empty($res)) { + ini_set('memory_limit','800M'); + $time = strtotime(date('Y-m-d 00:00:00', time())); + $map['login_time'] = ['lt', $time]; + + $this->userPlayLoginRecordByDayByMap($map); + echo '初始化成功'; + } else { + echo '表存在记录,无法初始化'; + } + } + + //玩家角色每日登录记录 + private function userPlayLoginRecordByDayByMap($map = []) + { + if (isset($map['login_time'])) { + $map['game_id'] = ['gt', 0]; + $field = 'FROM_UNIXTIME(login_time, "%Y-%m-%d") as day,user_id,game_id'; + $loginData = M('user_game_login_record', 'tab_')->field($field) + ->where($map) + ->group('day,game_id,user_id') + ->select(); + + if (!empty($loginData)) { + $data = []; + foreach ($loginData as &$list) { + $data[] = [ + 'user_id' => $list['user_id'], + 'game_id' => $list['game_id'], + 'server_id' => '', + 'role_id' => '', + 'create_time' => strtotime($list['day']), + ]; + unset($list); + } + unset($loginData); + M('user_play_login_record_by_day', 'tab_')->addAll($data); + } + } + } } diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 3cb662551..b667996d0 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1759,7 +1759,7 @@ class QueryController extends BaseController $lastSortName = trim(I('last_sort_name', '')); $sortName = trim(I('sort_name', '')); $sort = intval(I('sort', 1)); - $sortNameData = ['recharge_cost', 'recharge_count', 'recharge_cost_today', 'unlogin_day']; + $sortNameData = ['recharge_cost', 'recharge_count', 'recharge_cost_today', 'unlogin_day', 'create_time', 'user_game_login_count']; $nowTime = date('Y-m-d', time() - 3600 * 24); $initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime))); $initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime'); @@ -1855,8 +1855,15 @@ class QueryController extends BaseController $map['uc.create_time'] = ['between', [$begTime, $endTime - 1]]; $fieldUC = "sum(uc.recharge_cost) recharge_cost,sum(uc.recharge_count) recharge_count,sum(if(uc.create_time = {$nowTime},uc.recharge_cost,0)) as recharge_cost_today"; - $fieldUI = "ui.user_account,ui.game_name,ui.role_name,ui.role_level,ui.server_name,ui.play_time,ui.play_ip,ui.promote_account,ui.sdk_version"; - $field = $fieldUC . ',' . $fieldUI; + $fieldUI = "ui.user_account,ui.game_name,ui.role_name,ui.role_level,ui.server_name,ui.play_time,ui.play_ip,ui.promote_account,ui.sdk_version,ui.create_time"; + + $loginRecordMap['lr.create_time'] = $map['uc.create_time']; + $loginRecordMap['_string'] = 'lr.user_id = uc.user_id and lr.game_id = uc.game_id'; + $fieldLR = M('user_play_login_record_by_day', 'tab_')->alias('lr') + ->field("count(*) as count") + ->where($loginRecordMap) + ->buildSql(); + $field = $fieldUC . ',' . $fieldUI . ',' . $fieldLR . ' as user_game_login_count'; $subQuery = M('user_play_data_count', 'tab_')->alias('uc') ->field($field) ->join('left join tab_user_play_info as ui on ui.user_id = uc.user_id and ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id') @@ -1883,6 +1890,7 @@ class QueryController extends BaseController $list['role_level'] = empty($list['role_level']) ? '--' : $list['role_level']; $list['unlogin_day'] = empty($list['play_time']) ? '--' : intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $list['play_time']))) / (24 * 3600)); $list['play_time'] = empty($list['play_time']) ? '--' : date('Y-m-d H:i:s', $list['play_time']); + $list['create_time'] = empty($list['create_time']) ? '--' : date('Y-m-d H:i:s', $list['create_time']); $list['promote_account'] = empty($list['promote_account']) ? '--' : $list['promote_account']; } } diff --git a/Application/Home/View/default/Home/landingPage2.html b/Application/Home/View/default/Home/landingPage2.html index 006f0cce6..ff3b72c39 100644 --- a/Application/Home/View/default/Home/landingPage2.html +++ b/Application/Home/View/default/Home/landingPage2.html @@ -26,17 +26,13 @@ .home-video video { margin-left: 0.45%; width: 84.75%; + border-radius: 4.5%; } @media(min-width:580px){ .home-video { max-width:580px; } } - @media(min-height:580px){ - .home-video { - max-width:580px; - } - } diff --git a/Application/Home/View/default/Query/userRecharges.html b/Application/Home/View/default/Query/userRecharges.html index fbc9d3f99..007453957 100644 --- a/Application/Home/View/default/Query/userRecharges.html +++ b/Application/Home/View/default/Query/userRecharges.html @@ -145,6 +145,28 @@ + 玩家游戏累计登录天数 + + + + + + + + + + + 注册时间 + + + + + + + + + + 最后登录时间 推广员账号 @@ -163,6 +185,8 @@ {$record.recharge_count} {$record.recharge_cost_today} {$record.unlogin_day} + {$record.user_game_login_count} + {$record.create_time} {$record.play_time} {$record.promote_account} diff --git a/Data/update.sql b/Data/update.sql index c365cc758..9e638d22b 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -656,3 +656,16 @@ ALTER TABLE tab_game ADD `supersign_status` tinyint(1) DEFAULT '1' COMMENT '超 -- 新旧IOS打包标识 ALTER TABLE `tab_game_source` add COLUMN `is_new_sdk` tinyint(2) DEFAULT '0' COMMENT '是否新SDK(IOS)'; + +--2019-12-11 cxj +--玩家角色每日登录记录表 +CREATE TABLE `tab_user_play_login_record_by_day` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL DEFAULT 0 COMMENT '玩家id', + `game_id` int(11) NOT NULL DEFAULT 0 COMMENT '游戏id', + `server_id` varchar(30) NOT NULL DEFAULT '' COMMENT '区服id', + `role_id` varchar(30) NOT NULL DEFAULT '' COMMENT '角色id', + `create_time` int(10) NOT NULL DEFAULT 0 COMMENT '创建时间', + PRIMARY KEY (`id`), + INDEX `search`(`user_id`, `game_id`, `create_time`) USING BTREE +); \ No newline at end of file