|
|
|
@ -1054,52 +1054,58 @@ class ExportController extends Controller
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
|
|
|
|
|
$startDate = empty($_REQUEST['timestart']) ? date('Y-m-d', strtotime('-6 day', time())) : $_REQUEST['timestart'];
|
|
|
|
|
$endDate = empty($_REQUEST['timeend']) ? date('Y-m-d') : $_REQUEST['timeend'];
|
|
|
|
|
|
|
|
|
|
$startTime = strtotime($startDate);
|
|
|
|
|
$endTime = strtotime($endDate) + 86399;
|
|
|
|
|
$map['pay_time'] = array('BETWEEN', array($startTime, $endTime));
|
|
|
|
|
|
|
|
|
|
unset($_REQUEST['timestart']);
|
|
|
|
|
unset($_REQUEST['timeend']);
|
|
|
|
|
|
|
|
|
|
if (isset($_REQUEST['user_account'])) {
|
|
|
|
|
$map['user_account'] = array('like', '%' . trim($_REQUEST['user_account']) . '%');
|
|
|
|
|
$map['user_account'] = array('like', trim($_REQUEST['user_account']));
|
|
|
|
|
unset($_REQUEST['user_account']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['spend_ip'])) {
|
|
|
|
|
$map['spend_ip'] = array('like', '%' . trim($_REQUEST['spend_ip']) . '%');
|
|
|
|
|
$map['spend_ip'] = array('like', trim($_REQUEST['spend_ip']) . '%');
|
|
|
|
|
unset($_REQUEST['spend_ip']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['time-start']) && isset($_REQUEST['time-end'])) {
|
|
|
|
|
$map['pay_time'] = array('BETWEEN', array(strtotime($_REQUEST['time-start']), strtotime($_REQUEST['time-end']) + 24 * 60 * 60 - 1));
|
|
|
|
|
unset($_REQUEST['time-start']);
|
|
|
|
|
unset($_REQUEST['time-end']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])) {
|
|
|
|
|
$map['pay_time'] = array('BETWEEN', array(strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 24 * 60 * 60 - 1));
|
|
|
|
|
unset($_REQUEST['timestart']);
|
|
|
|
|
unset($_REQUEST['timeend']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['start']) && isset($_REQUEST['end'])) {
|
|
|
|
|
$map['pay_time'] = array('BETWEEN', array(strtotime($_REQUEST['start']), strtotime($_REQUEST['end']) + 24 * 60 * 60 - 1));
|
|
|
|
|
unset($_REQUEST['start']);
|
|
|
|
|
unset($_REQUEST['end']);
|
|
|
|
|
}
|
|
|
|
|
if(isset($_REQUEST['game_name'])){
|
|
|
|
|
if($_REQUEST['game_name']=='全部'){
|
|
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
|
|
if ($_REQUEST['game_name'] == '全部') {
|
|
|
|
|
unset($_REQUEST['game_name']);
|
|
|
|
|
}else{
|
|
|
|
|
$map['tab_spend.game_id']= ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')];
|
|
|
|
|
} else {
|
|
|
|
|
$map['game_id'] = ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')];
|
|
|
|
|
unset($_REQUEST['game_name']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(isset($_REQUEST['server_name'])){
|
|
|
|
|
$map['tab_spend.server_name']=$_REQUEST['server_name'];
|
|
|
|
|
unset($_REQUEST['server_name']);
|
|
|
|
|
if (isset($_REQUEST['game_type']) && $_REQUEST['game_type']) {
|
|
|
|
|
$map['sdk_version'] = $_REQUEST['game_type'];
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['server_id'])) {
|
|
|
|
|
$map['server_id'] = $_REQUEST['server_id'];
|
|
|
|
|
unset($_REQUEST['server_id']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['pay_order_number'])) {
|
|
|
|
|
$map['pay_order_number'] = array('like', '%' . trim($_REQUEST['pay_order_number']) . '%');
|
|
|
|
|
$map['pay_order_number'] = array('like', trim($_REQUEST['pay_order_number']));
|
|
|
|
|
unset($_REQUEST['pay_order_number']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['extend'])) {
|
|
|
|
|
$map['extend'] = array('like', trim($_REQUEST['extend']));
|
|
|
|
|
unset($_REQUEST['extend']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['pay_status'])) {
|
|
|
|
|
$map['pay_status'] = $_REQUEST['pay_status'];
|
|
|
|
|
unset($_REQUEST['pay_status']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['pay_way'])) {
|
|
|
|
|
if ($_REQUEST['pay_way'] == 2) {
|
|
|
|
|
$map['pay_way'] = ['in', '2,3,4'];
|
|
|
|
|
} else {
|
|
|
|
|
$map['pay_way'] = $_REQUEST['pay_way'];
|
|
|
|
|
unset($_REQUEST['pay_status']);
|
|
|
|
|
}
|
|
|
|
|
unset($_REQUEST['pay_way']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['pay_game_status'])) {
|
|
|
|
|
$map['pay_game_status'] = $_REQUEST['pay_game_status'];
|
|
|
|
@ -1116,25 +1122,40 @@ class ExportController extends Controller
|
|
|
|
|
// }
|
|
|
|
|
setPowerPromoteIds($map,'promote_id');
|
|
|
|
|
|
|
|
|
|
if(isset($_REQUEST['promote_id'])) {
|
|
|
|
|
if ($_REQUEST['promote_id'] == 0) {
|
|
|
|
|
if (isset($_REQUEST['promote_id'])) {
|
|
|
|
|
$promoteId = intval($_REQUEST['promote_id']);
|
|
|
|
|
if ($promoteId == 0) {
|
|
|
|
|
$map['promote_id'] = 0;
|
|
|
|
|
} else {
|
|
|
|
|
$map['_complex'] = ['tp.chain'=>['like', "%/{$_REQUEST['promote_id']}/%"], 'tp.id'=>$_REQUEST['promote_id'], '_logic' => 'or'];
|
|
|
|
|
$promoteMap['chain'] = ['like', "%/$promoteId/%"];
|
|
|
|
|
$promoteIds = M('Promote', 'tab_')->where($promoteMap)->getField('id', true);
|
|
|
|
|
$promoteIds[] = $promoteId;
|
|
|
|
|
$map['promote_id'] = ['in', $promoteIds];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$tab_promote_join = "left join tab_promote as tp on tp.id = tab_spend.promote_id";
|
|
|
|
|
//unset($_REQUEST['promote_id']);
|
|
|
|
|
if ($_REQUEST['data_order'] != '') {
|
|
|
|
|
$data_order = reset(explode(',', $_REQUEST['data_order']));
|
|
|
|
|
$data_order_type = end(explode(',', $_REQUEST['data_order']));
|
|
|
|
|
$this->assign('userarpu_order', $data_order);
|
|
|
|
|
$this->assign('userarpu_order_type', $data_order_type);
|
|
|
|
|
$sort = $data_order == 3 ? 'desc' : 'asc';
|
|
|
|
|
$order = $data_order_type . ' ' . $sort;
|
|
|
|
|
} else {
|
|
|
|
|
$tab_promote_join = false;
|
|
|
|
|
$order = ' pay_time desc ';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (intval(($endTime + 1) - $startTime) / (24 * 3600) <= 31) {
|
|
|
|
|
// $map1 = $map;
|
|
|
|
|
// $map1['pay_status'] = 1;
|
|
|
|
|
// } else {
|
|
|
|
|
// $map = '1 = 2';
|
|
|
|
|
// $map1 = $map;
|
|
|
|
|
// }
|
|
|
|
|
$map1 = $map;
|
|
|
|
|
$map1['pay_status'] = 1;
|
|
|
|
|
$total = D('Spend')->where($map1)->join($tab_promote_join)->sum('pay_amount');
|
|
|
|
|
if (isset($map['pay_status']) && $map['pay_status'] == 0) {
|
|
|
|
|
$total = sprintf("%.2f", 0);
|
|
|
|
|
} else {
|
|
|
|
|
$total = sprintf("%.2f", $total);
|
|
|
|
|
}
|
|
|
|
|
$total = M('Spend','tab_')->where($map1)->sum('pay_amount');
|
|
|
|
|
// var_dump($total);die();
|
|
|
|
|
$total=$total?$total:0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$xlsCell = array(
|
|
|
|
@ -1155,10 +1176,7 @@ class ExportController extends Controller
|
|
|
|
|
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
|
|
|
|
|
|
|
|
|
|
$accessNum = D('Spend')
|
|
|
|
|
->field('pay_order_number,pay_time,user_account,game_name,promote_account,spend_ip,server_name,game_player_id,game_player_name,cost,pay_amount,pay_way,pay_status,pay_game_status')
|
|
|
|
|
->where($map)
|
|
|
|
|
->join($tab_promote_join)
|
|
|
|
|
->order('pay_time DESC')
|
|
|
|
|
->count();
|
|
|
|
|
|
|
|
|
|
$perSize = 10000;//每次查询的条数
|
|
|
|
@ -1167,15 +1185,21 @@ class ExportController extends Controller
|
|
|
|
|
// var_dump($count);die();
|
|
|
|
|
for($i = 1; $i <= $pages; $i++) {
|
|
|
|
|
$xlsData = D('Spend')
|
|
|
|
|
// ->field('pay_order_number,extend,pay_time,user_account,game_name,promote_account,spend_ip,server_id,server_name,game_player_id,game_player_name,cost,pay_amount,pay_way,pay_status,pay_game_status')
|
|
|
|
|
// ->where($map)
|
|
|
|
|
// ->limit(($i-1)*$perSize ,$perSize)
|
|
|
|
|
// ->join($tab_promote_join)
|
|
|
|
|
// ->order('pay_time DESC')
|
|
|
|
|
// ->select();
|
|
|
|
|
->field('pay_order_number,extend,pay_time,user_account,game_name,promote_account,spend_ip,server_id,server_name,game_player_id,game_player_name,cost,pay_amount,pay_way,pay_status,pay_game_status')
|
|
|
|
|
->where($map)
|
|
|
|
|
->limit(($i-1)*$perSize ,$perSize)
|
|
|
|
|
->join($tab_promote_join)
|
|
|
|
|
->order('pay_time DESC')
|
|
|
|
|
->order($order ? $order : 'pay_time desc')
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
foreach($xlsData as $value) {
|
|
|
|
|
$value['pay_time'] = date('Y-m-d H:i:s',$value['pay_time']);
|
|
|
|
|
$value['extend'] = $value['extend'].'`';
|
|
|
|
|
$value['pay_way'] = get_pay_way($value['pay_way']);
|
|
|
|
|
$value['pay_status'] = get_info_status($value['pay_status'],9);
|
|
|
|
|
$value['pay_game_status'] = get_info_status($value['pay_game_status'],14);
|
|
|
|
|