From 3281348345ae2937f9d0914fa06235eb0731f2f1 Mon Sep 17 00:00:00 2001 From: tping Date: Tue, 15 Dec 2020 17:45:08 +0800 Subject: [PATCH 1/3] =?UTF-8?q?1,=E7=99=BB=E5=85=A5=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=202=EF=BC=8C=E4=B8=8B=E8=BD=BD=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FengHuoApi2Controller.class.php | 141 ++++++++++++++++++ 1 file changed, 141 insertions(+) diff --git a/Application/Sdk/Controller/FengHuoApi2Controller.class.php b/Application/Sdk/Controller/FengHuoApi2Controller.class.php index c41c1ff7..37433d0c 100644 --- a/Application/Sdk/Controller/FengHuoApi2Controller.class.php +++ b/Application/Sdk/Controller/FengHuoApi2Controller.class.php @@ -288,6 +288,147 @@ class FengHuoApi2Controller extends GetInfoBaseController{ } + // 登入历史信息 + public function loginHistoryInfo(){ + $where = []; + $page = $_REQUEST['page']; + $pageSize = $_REQUEST['page_size']; + + //时间区间 +// if (isset($time)) { +// $where['login_time'] = array('between',[$time,$time+86399]); +// } +// 第几页数据 + $page = intval($page); + $page = $page ? $page : 1; //默认显示第一页数据 +// 一页显示数据的条数 + $pageSize = intval($pageSize); + $row = $pageSize ? $pageSize : 1000; + $order = 'id asc'; + + $data = M('user','tab_') + ->field('id,nickname,login_time as last_login_time,last_login_ip, login_ip') + ->where($where) + ->order($order) + ->page($page, $row) + ->select(); + foreach ($data as &$v) { + if (!$v['last_login_ip']) + $v['last_login_ip'] = $v['login_ip']; + } + + if($data){ + $result = [ + 'ResultCode' => 1, + 'ResultMessage' => "调用成功", + 'Data' => $data + ]; + }else{ + $result = [ + 'ResultCode' => 1, + 'ResultMessage' => "没有数据,换个条件试试吧", + ]; + } + + Log::write('loginInfo:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($result), 'INFO'); + + return $this->ajaxReturn($result); + + } + + // 下载记录 + public function downloadLog(){ + $where = []; +// $time = $_REQUEST['time']; + $page = $_REQUEST['page']; + $pageSize = $_REQUEST['page_size']; + + //时间区间 +// if (isset($time)) { +// $where['login_time'] = array('between',[$time,$time+86399]); +// } +// 第几页数据 + $page = intval($page); + $page = $page ? $page : 1; //默认显示第一页数据 +// 一页显示数据的条数 + $pageSize = intval($pageSize); + $row = $pageSize ? $pageSize : 1000; +// 默认排序:id降序 + $order = 'id asc'; + + $where['type'] = 6; + + $ret = M('user_action_log','tab_') + ->field('id,game_id,action,ip,create_time') + ->where($where) + ->order($order) + ->page($page, $row) + ->select(); + + $data = []; + foreach ($ret as $k=>$v){ + $needle = 'landingPage/code/'; + $code = substr($v['action'], strpos($v['action'], $needle)+strlen($needle)); + $promote = $this->decodeApplyCode($code); + $promoteId = $promote['promote_id']; + if(!$promoteId){ + $data[$k]['promote_id'] = 0; + $data[$k]['promote_account'] = '官方渠道'; + }else{ + $promoteInfo = M('promote','tab_') + ->field('account') + ->where('id',$promoteId) + ->find(); + $data[$k]['promote_id'] = $promoteId; + $data[$k]['promote_account'] = $promoteInfo['account']; + } + $game = M('game', 'tab_')->where(['id' => $v['game_id']])->find(); + $data[$k]['game_id'] = $v['game_id']; + $data[$k]['game_name'] = $game['game_name']; + $data[$k]['ip'] = $v['ip']; + $data[$k]['create_time'] = $v['create_time']; + } + + if($data){ + $result = [ + 'ResultCode' => 1, + 'ResultMessage' => "调用成功", + 'Data' => $data + ]; + }else{ + $result = [ + 'ResultCode' => 1, + 'ResultMessage' => "没有数据,换个条件试试吧", + ]; + } + + Log::write('loginInfo:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($result), 'INFO'); + + return $this->ajaxReturn($result); + + } + + private function decodeApplyCode($code) + { + $decryptStr = openssl_decrypt(base64_decode($code), 'AES-256-ECB', 'WmtX1@#Landing&Download2048'); + $result = json_decode($decryptStr, true); + if (is_null($result)) { + $items = explode('|', $decryptStr); + if (count($items) != 5) { + return null; + } + return [ + 'promote_id' => $items[0], + 'game_id' => $items[1], + 'expires_in' => $items[2], + 'created_at' => date('Y-m-d H:i:s', $items[3]), + 'type' => $items[4], + ]; + } + return $result; + } + + /** * 换绑记录 * @param From 3da7adcf3d6f3a8002a260f20c08178d6903a096 Mon Sep 17 00:00:00 2001 From: tping Date: Tue, 15 Dec 2020 17:54:55 +0800 Subject: [PATCH 2/3] =?UTF-8?q?1,=E7=99=BB=E5=85=A5=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=202=EF=BC=8C=E4=B8=8B=E8=BD=BD=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sdk/Controller/FengHuoApi2Controller.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Application/Sdk/Controller/FengHuoApi2Controller.class.php b/Application/Sdk/Controller/FengHuoApi2Controller.class.php index 37433d0c..9b3e704b 100644 --- a/Application/Sdk/Controller/FengHuoApi2Controller.class.php +++ b/Application/Sdk/Controller/FengHuoApi2Controller.class.php @@ -304,7 +304,7 @@ class FengHuoApi2Controller extends GetInfoBaseController{ // 一页显示数据的条数 $pageSize = intval($pageSize); $row = $pageSize ? $pageSize : 1000; - $order = 'id asc'; + $order = 'id desc'; $data = M('user','tab_') ->field('id,nickname,login_time as last_login_time,last_login_ip, login_ip') @@ -330,7 +330,7 @@ class FengHuoApi2Controller extends GetInfoBaseController{ ]; } - Log::write('loginInfo:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($result), 'INFO'); + Log::write('loginHistoryInfo:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($result), 'INFO'); return $this->ajaxReturn($result); @@ -402,7 +402,7 @@ class FengHuoApi2Controller extends GetInfoBaseController{ ]; } - Log::write('loginInfo:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($result), 'INFO'); + Log::write('downloadLog:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($result), 'INFO'); return $this->ajaxReturn($result); From 37b7096a4ba3fd88a6cff314a5cc6f9e1acfca6a Mon Sep 17 00:00:00 2001 From: tping Date: Tue, 15 Dec 2020 18:19:02 +0800 Subject: [PATCH 3/3] 1 --- Application/Sdk/Controller/FengHuoApi2Controller.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Sdk/Controller/FengHuoApi2Controller.class.php b/Application/Sdk/Controller/FengHuoApi2Controller.class.php index 9b3e704b..941c2561 100644 --- a/Application/Sdk/Controller/FengHuoApi2Controller.class.php +++ b/Application/Sdk/Controller/FengHuoApi2Controller.class.php @@ -354,7 +354,7 @@ class FengHuoApi2Controller extends GetInfoBaseController{ $pageSize = intval($pageSize); $row = $pageSize ? $pageSize : 1000; // 默认排序:id降序 - $order = 'id asc'; + $order = 'id desc'; $where['type'] = 6;