游戏订单查看-导出excell

master
liuweiwen 5 years ago
parent 750572bc21
commit 53a235379a

@ -6511,6 +6511,85 @@ if ($key == 'model'){
$this->exportExcel($xlsName, $xlsCell, $xlsData);
}
public function gameStatisticsDetail() {
$game_name = I("game_name");
$xlsName = $game_name . '游戏订单查看';
$xlsCell = array(
array('pay_order_number','支付订单号'),
array('extend','游戏订单号'),
array('pay_time','充值时间'),
array('user_account','玩家账号'),
array('game_name','游戏名称'),
array('promote_account','所属推广员'),
array('spend_ip','充值ip'),
array('server_name','游戏区服'),
array('game_player_name','角色名称'),
array('cost','订单金额'),
array('pay_amount','实付金额'),
array('pay_way','充值方式'),
);
if (isset($_REQUEST['pay_way'])) {
$map['pay_way'] = $_REQUEST['pay_way'];
}
if (!empty($_REQUEST['pay_order_number'])) {
$map['pay_order_number'] = $_REQUEST['pay_order_number'];
}
if (!empty(I('partner_id'))&&empty(I("game_id"))) {
$wherePartner = I('partner_id');
$gameId = M("game","tab_")->field("id")->where("partner_id={$wherePartner}")->select();
$gameId = implode(',',array_column($gameId,'id'));
$map['game_id'] = ['in',$gameId];
}
if (!empty(I('timestart'))) {
$timestart = strtotime(I('timestart'));
$map['_string'] = "pay_time > {$timestart}";
}
if (!empty(I('timeend'))) {
$timeend = strtotime(I('timeend'));
$map['_string'] .= " and pay_time < {$timeend}";
}
$map['pay_status'] = 1;
if (!empty(I("game_id"))) {
$map['game_id'] = I("game_id");
}
if (!empty(I('user_account'))) {
$map['user_account'] = array('like','%'.I("user_account").'%');
}
if (!empty(I('user_nickname'))) {
$map['game_player_name'] = array('like',I("user_nickname").'%');
}
$field = "pay_order_number,FROM_UNIXTIME(pay_time) as pay_time,user_account,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way,extend";
$group = "";
$order = "pay_time DESC";
$xlsData = D('spend')->getSpendData($map,$field,$group,$order);
foreach($xlsData as $key => $value) {
$xlsData[$key]['pay_way'] = getPayType($value['pay_way']);
}
$totalData = D("spend")->totalGameStatistics($map, false);
$sumCash = $totalData['cash_count'] ?? 0;
$sumBalance = $totalData['balance_coin_count'] ?? 0;
$sumInside = $totalData['inside_cash_count'] ?? 0;
$sumAll = $sumCash + $sumBalance + $sumInside;
$sumData = [['pay_order_number'=>'总计:' . $sumAll,
'extend'=>'现金金额:' . $sumCash,
'pay_time'=>'平台币:' . $sumBalance,
'user_account'=>'绑币:' . $sumInside]];
$xlsData = array_merge($xlsData,$sumData);
$this->exportExcel($xlsName, $xlsCell, $xlsData);
}
function gameFinanceDetail() {
// set_time_limit(0);

@ -755,19 +755,6 @@ class FinanceController extends ThinkController
public function gameStatisticsDetail($p = 1) {
set_time_limit(0);
if (!empty(I("promote_id"))) {
$promote_id[] = I("promote_id");
}
if (!empty(I("root_id"))) {
$root_id = I("root_id");
$promote_id = $this->getPromoteList($root_id);
array_push($promote_id,$root_id);
}
if ($_REQUEST['root_id']=='0') {
$map['promote_id'] = $_REQUEST['root_id'];
}
if (isset($_REQUEST['pay_way'])) {
$map['pay_way'] = $_REQUEST['pay_way'];
@ -777,17 +764,6 @@ class FinanceController extends ThinkController
$map['pay_order_number'] = $_REQUEST['pay_order_number'];
}
if (!empty(I("parent_id"))) {
$parent_id = I("parent_id");
$promote_id = $this->getPromoteList($parent_id);
array_push($promote_id,$parent_id);
}
$promote_id = implode(',',$promote_id);
if ($promote_id) {
$map['promote_id'] = ['in',$promote_id];
}
if (!empty(I('partner_id'))&&empty(I("game_id"))) {
$wherePartner = I('partner_id');
$gameId = M("game","tab_")->field("id")->where("partner_id={$wherePartner}")->select();
@ -807,17 +783,11 @@ class FinanceController extends ThinkController
// var_dump($map);die();
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$row=10;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
if (!empty(I("count_date"))) {
$month = I("count_date");
$tarry = explode('-',$month);
$startTime=mktime(0,0,0,$tarry[1],1,$tarry[0]);
$endTime =mktime(0,0,0,$tarry[1]-0+1,1,$tarry[0])-1;
$map['pay_time'] = array('between',array($startTime,$endTime));
if (isset($_REQUEST['row'])) {
$row = $_REQUEST['row'];
} else {
$row = 10;
}
$map['pay_status'] = 1;
if (!empty(I("game_id"))) {
$map['game_id'] = I("game_id");
@ -833,16 +803,14 @@ class FinanceController extends ThinkController
$group = "";
$order = "pay_time DESC";
$data = D('spend')->getSpendData($map,$field,$group,$order,$page,$row);
// echo D("spend")->_sql();die();
foreach($data as $key => $value) {
$data[$key]['pay_way'] = getPayType($value['pay_way']);
}
$totalData = D('spend')->totalGameStatistics($map, false);
$sumCash = $totalData['cash_count'];
$sumBalance = $totalData['balance_coin_count'];
$sumInside = $totalData['inside_cash_count'];
$sumCash = $totalData['cash_count'] ?? 0;
$sumBalance = $totalData['balance_coin_count'] ?? 0;
$sumInside = $totalData['inside_cash_count'] ?? 0;
$sumAll = $sumCash + $sumBalance + $sumInside;
$this->assign('sumCash', $sumCash);

@ -98,7 +98,7 @@
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="sdk_type" name="sdk_type" class="select_gallery" >
<option value="">设备类型</option>
<option value="">请选择设备类型</option>
<option value="1">安卓</option>
<option value="2">苹果</option>
</select>
@ -187,6 +187,7 @@
'timeend'=>$_GET['timeend'],
'sdk_type'=>$_GET['sdk_type'],
'game_id'=>$data['game_id'],
'game_name'=>$data['game_name'],
'partner_id'=>$_REQUEST['partner_id'],
false))}" >查看</a>
</td>

@ -92,7 +92,7 @@
<a class="sch-btn" href="javascript:;" id="search" url="{:U('Finance/gameStatisticsDetail','model='.$model['name'].'&row='.I('row'),false)}"
style="">搜索</a>
<if condition="$_GET['all'] neq 1">
<a class="sch-btn" href="{:U('Export/gameFinanceDetail',
<a class="sch-btn" href="{:U('Export/gameStatisticsDetail',
array(
'game_id'=>$_GET['game_id'],
'game_name'=>$_GET['game_name'],

Loading…
Cancel
Save