用户导出修改

master
zhengyongxing 5 years ago
parent b305069da9
commit 6e151dd8a4

@ -364,10 +364,20 @@ class ExportController extends Controller
// if (isset($_REQUEST['game_name'])) { // if (isset($_REQUEST['game_name'])) {
// //$game_map .= " and tab_user_play.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")"; // //$game_map .= " and tab_user_play.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")";
// } // }
$game_map = "";
$game_map .= " and tab_user_play.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")";
$spendprom = " and ss.game_id in (".implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')).")"; $spendprom = " and ss.game_id in (".implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')).")";
if (isset($_REQUEST['server_name'])) { if (isset($_REQUEST['server_name'])) {
$map['server_name'] = ['like', "{$_REQUEST['server_name']}%"]; $map['server_name'] = ['like', "{$_REQUEST['server_name']}%"];
} }
$game_play_map = '';
if (isset($_REQUEST['server_name'])) {
$game_play_map .= " and tab_user_play_info.server_name = '{$_REQUEST['server_name']}' ";
}
if (isset($_REQUEST['viplevel'])) { if (isset($_REQUEST['viplevel'])) {
@ -409,7 +419,7 @@ class ExportController extends Controller
// '序号ID', '姓名', '电话', // '序号ID', '姓名', '电话',
// ]; // ];
$fileName = '导出.xlsx'; // $fileName = '导出.xlsx';
$csvFileName = $xlsName.'.csv'; $csvFileName = $xlsName.'.csv';
//设置好告诉浏览器要下载excel文件的headers //设置好告诉浏览器要下载excel文件的headers
header('Content-Description: File Transfer'); header('Content-Description: File Transfer');
@ -454,6 +464,8 @@ class ExportController extends Controller
if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){ if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){
$xlsData = $usermodel->table('(' . $sql1 . ') as a ')->field($field) $xlsData = $usermodel->table('(' . $sql1 . ') as a ')->field($field)
->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1'.$spendprom) ->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1'.$spendprom)
->join($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false)
->limit(($i-1)*$perSize ,$perSize) ->limit(($i-1)*$perSize ,$perSize)
->having($havs) ->having($havs)
->group('a.id') ->group('a.id')
@ -463,12 +475,15 @@ class ExportController extends Controller
}else{ }else{
$xlsData = $usermodel->table('(' . $sql1 . ') as a ')->field($field) $xlsData = $usermodel->table('(' . $sql1 . ') as a ')->field($field)
->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1') ->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1')
->join($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false)
->limit(($i-1)*$perSize ,$perSize) ->limit(($i-1)*$perSize ,$perSize)
->having($havs) ->having($havs)
->group('a.id') ->group('a.id')
->order($order) ->order($order)
->select(); ->select();
} }
// echo $usermodel->_sql();die();
//数据 //数据
@ -489,7 +504,7 @@ class ExportController extends Controller
if($_REQUEST['type']==2){ if($_REQUEST['type']==2){
$xlsData[$k]['register_type'] = get_registertype($v['register_type']); $xlsData[$k]['register_type'] = get_registertype($v['register_type']);
} }
if ($_REQUEST['type']==1) { if ($_REQUEST['type']!=2) {
$xlsData[$k]['register_time'] = date('Y-m-d H:i:s',$xlsData[$k]['register_time']); $xlsData[$k]['register_time'] = date('Y-m-d H:i:s',$xlsData[$k]['register_time']);
} }

Loading…
Cancel
Save