diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php
index 6e46c418f..b795cbbc9 100644
--- a/Application/Admin/Controller/ExportController.class.php
+++ b/Application/Admin/Controller/ExportController.class.php
@@ -3424,80 +3424,127 @@ if ($key == 'model'){
* 登录记录
* @author 鹿文学
*/
- public function login_record() {
+ public function login_record() {
- $xlsName = $_REQUEST['xlsname'];
+ $xlsName = $_REQUEST['xlsname'];
- $xlsCell = array(
- array('user_account','玩家账号'),
- array('game_name','游戏名称'),
- array('server_name','游戏区服'),
- array('user_nickname','角色名'),
- array('login_time','登录时间'),
- array('login_ip','最后登录ip'),
- );
+// $xlsCell = array(
+// array('user_account','玩家账号'),
+// array('game_name','游戏名称'),
+// array('server_name','游戏区服'),
+// array('user_nickname','角色名'),
+// array('login_time','登录时间'),
+// array('login_ip','最后登录ip'),
+// );
+ $xlsCell = array(
+ '玩家账号',
+ '游戏名称',
+ '游戏区服',
+ '角色名',
+ '登录时间',
+ '最后登录ip',
+ );
- if (isset($_REQUEST['login_ip'])) {
- $map['login_ip'] = $_REQUEST['login_ip'];
- }
- if (isset($_REQUEST['game_id'])) {
- $map['game_id'] = $_REQUEST['game_id'];
- }
- if (isset($_REQUEST['game_name'])) {
- $map['game_name'] = ['like', $_REQUEST['game_name']."%"];
- unset($_REQUEST['game_name']);
- }
- if (isset($_REQUEST['game_type'])) {
- $map['sdk_version'] = $_REQUEST['game_type'];
- unset($_REQUEST['game_type']);
- }
- if (isset($_REQUEST['server_name'])) {
- $map['server_name'] = $_REQUEST['server_name'];
- unset($_REQUEST['server_name']);
- }
- if (isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])) {
- $map['login_time'] = array('BETWEEN', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 24 * 60 * 60 - 1));
- }elseif(isset($_REQUEST['timestart'])){
- $map['login_time'] = array('GT',strtotime($_REQUEST['timestart']));
- }elseif(isset($_REQUEST['timeend'])){
- $map['login_time'] = array('lt',(strtotime($_REQUEST['timeend'])+ 24 * 60 * 60 - 1));
- }
- if (isset($_REQUEST['account'])) {
- $map['user_account'] = array('like', '%' . trim($_REQUEST['account']) . '%');
- }
-
- $map['login_time'] = array('neq', 0);
- $page = intval($_REQUEST['p']);
+ if (isset($_REQUEST['login_ip'])) {
+ $map['login_ip'] = $_REQUEST['login_ip'];
+ }
+ if (isset($_REQUEST['game_id'])) {
+ $map['game_id'] = $_REQUEST['game_id'];
+ }
+ if (isset($_REQUEST['game_name'])) {
+ $map['game_name'] = ['like', $_REQUEST['game_name']."%"];
+ unset($_REQUEST['game_name']);
+ }
+ if (isset($_REQUEST['game_type'])) {
+ $map['sdk_version'] = $_REQUEST['game_type'];
+ unset($_REQUEST['game_type']);
+ }
+ if (isset($_REQUEST['server_name'])) {
+ $map['server_name'] = $_REQUEST['server_name'];
+ unset($_REQUEST['server_name']);
+ }
+ if (isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])) {
+ $map['login_time'] = array('BETWEEN', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 24 * 60 * 60 - 1));
+ }elseif(isset($_REQUEST['timestart'])){
+ $map['login_time'] = array('GT',strtotime($_REQUEST['timestart']));
+ }elseif(isset($_REQUEST['timeend'])){
+ $map['login_time'] = array('lt',(strtotime($_REQUEST['timeend'])+ 24 * 60 * 60 - 1));
+ }
+ if (isset($_REQUEST['account'])) {
+ $map['user_account'] = array('like', '%' . trim($_REQUEST['account']) . '%');
+ }
- $page = $page?$page:1;
+// $map['login_time'] = array('neq', 0);
- $row = $_REQUEST['row']?$_REQUEST['row']:10;
+ $page = intval($_REQUEST['p']);
- $data = M('UserLoginRecord','tab_')
- ->where($map)->order('id desc')->select();
+ $page = $page?$page:1;
- $xlsData = [];
+ $row = $_REQUEST['row']?$_REQUEST['row']:10;
- foreach($data as $k => $v) {
- $v['login_time'] = date('Y-m-d H:i:s',$v['login_time']);
- $v['server_name'] = empty($v['server_name'])?'空':$v['server_name'];
+ //查询数量
+ $accessNum = M('UserLoginRecord','tab_')
+ ->where($map)->order('id desc')->count();
- $gamename=trim(get_game_name($v['game_id'],'id'));
+ if ($accessNum > 1000000) {
+ echo "数据量过大,大于100万";die();
+ }
- $v['game_name'] = empty($gamename)?($v['type']==2?'APP登录':'平台登录'):$gamename;
+ $csvFileName = $xlsName.'.csv';
+ //设置好告诉浏览器要下载excel文件的headers
+ header('Content-Description: File Transfer');
+ header('Content-Type: application/vnd.ms-excel');
+ header('Content-Disposition: attachment; filename="'. $csvFileName .'"');
+ header('Expires: 0');
+ header('Cache-Control: must-revalidate');
+ header('Pragma: public');
+ $fp = fopen('php://output', 'a');//打开output流
+ mb_convert_variables('GBK', 'UTF-8', $xlsCell);
+ fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
- $xlsData[] = $v;
+ $perSize = 50000;//每次查询的条数
+ $pages = ceil($accessNum / $perSize);
+ for($i = 1; $i <= $pages; $i++) {
- }
+ $data = M('UserLoginRecord','tab_')
+ ->field("user_account,game_name,server_name,user_nickname,login_time,login_ip")
+ ->where($map)
+ ->limit(($i-1)*$perSize ,$perSize)
+ ->order('id desc')
+ ->select();
+ foreach($data as $k => $v) {
- $this->exportExcel($xlsName, $xlsCell, $xlsData);
+ $v['login_time'] = date('Y-m-d H:i:s',$v['login_time']);
+ $v['server_name'] = empty($v['server_name'])?'空':$v['server_name'];
- }
+// $gamename=trim(get_game_name($v['game_id'],'id'));
+
+// $v['game_name'] = empty($gamename)?($v['type']==2?'APP登录':'平台登录'):$gamename;
+
+ $xlsData[] = $v;
+
+ mb_convert_variables('GBK', 'UTF-8', $v);
+ fputcsv($fp, $v);
+ }
+
+ unset($xlsData);//释放变量的内存
+ //刷新输出缓冲到浏览器
+ ob_flush();
+ flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。
+ }
+// $xlsData = [];
+
+ exit();
+
+
+// $this->exportExcel($xlsName, $xlsCell, $xlsData);
+
+ }
/**
diff --git a/Application/Admin/Controller/MendController.class.php b/Application/Admin/Controller/MendController.class.php
index 16625e9d8..b4a22e062 100644
--- a/Application/Admin/Controller/MendController.class.php
+++ b/Application/Admin/Controller/MendController.class.php
@@ -132,9 +132,9 @@ class MendController extends ThinkController {
$id = I('id');
$status = M('ShiftTask')->where(['id' => $id,'status' => 0])->save(['status' => 2]);
if ($status) {
- $this->success('取消补链成功', U('lists'), 2);
+ $this->ajaxReturn(array("status"=>1,"url"=> U('lists')));
} else {
- $this->error("取消失败,或补链已生效",U('lists'));
+ $this->ajaxReturn(array("status"=>0,"url"=> U('lists')));
}
}
}
diff --git a/Application/Admin/View/Mend/shiftInfo.html b/Application/Admin/View/Mend/shiftInfo.html
index 768d1bd5c..050614e98 100644
--- a/Application/Admin/View/Mend/shiftInfo.html
+++ b/Application/Admin/View/Mend/shiftInfo.html
@@ -130,6 +130,7 @@
+