Merge branch 'dev_statistics' of 47.111.118.107:wmtx/platform into dev_statistics

master
zhengyongxing 5 years ago
commit d1a5b63be2

@ -1562,4 +1562,31 @@ function db2csv(&$data,$title,$header=false){
unlink($filename);
die();
}
//导出csv 新增字段排序功能
function data2csv(&$data,$title,$fields){
set_time_limit(0);
$filename = $title .'.csv';
$fp = fopen($filename, 'w'); //生成临时文件
fwrite($fp, chr(0xEF).chr(0xBB).chr(0xBF));//转码,防止乱码
$field = array_keys($fields);
$header = array_values($fields);
fputcsv($fp, $header);
foreach ($data as $row) {
$a = [];
foreach($field as $k=>$v){
$a[$v] = $row[$v];
}
fputcsv($fp, $a);
}
fclose($fp); //每生成一个文件关闭
//下载
header('Content-Type: application/vnd.ms-excel;charset=utf-8');
header('Content-Disposition: attachment;filename="' . $title . '.csv"');
header('Cache-Control: max-age=0');
header('Content-Length: ' . filesize($filename));
readfile($filename);
unlink($filename);
die();
}
?>

@ -73,6 +73,7 @@ class FinancePromoteController extends AdminController
if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0;
if(!array_key_exists('bind_coin_count',$v)) $v['bind_coin_count']=0;
if(!array_key_exists('inside_cash_count',$v)) $v['inside_cash_count']=0;
$v['promote_account'] = get_promote_name($v['p_id']);
$v['allcount'] = $v['cash_count']-0+$v['balance_coin_count']+$v['bind_coin_count'];
$count['cash_count'] += $v['cash_count'];
$count['balance_coin_count'] += $v['balance_coin_count'];
@ -82,6 +83,17 @@ class FinancePromoteController extends AdminController
$data[] = $v;
}
$data = my_sort($data, $data_order_type, (int)$data_order);
if(isset($_REQUEST['export'])){
data2csv($data,'公会统计',array(
"company_name"=>"推广公司",
"promote_account"=>"会长渠道",
"cash_count"=>"游戏现金金额",
"balance_coin_count"=>"平台币直充支出",
"bind_coin_count"=>"内充支出",
"inside_cash_count"=>"平台币内充",
"allcount"=>"渠道游戏内充值合计"
));die();
}
$this->assign('list_data', $data);
$this->assign('all_count', $count);
$this->meta_title = '公会统计';
@ -254,7 +266,7 @@ class FinancePromoteController extends AdminController
$field= "SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as bind_coin_count,
IFNULL(company_id,0) company_id,company_name,promote_id";
IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account";
return M()
->table("tab_spend s")
->field($field)

@ -203,7 +203,7 @@
<volist name="list_data" id="data">
<tr>
<td>{$data.company_name}</td>
<td>{:get_promote_name($data['p_id'])}</td>
<td>{$data['promote_account']}</td>
<td>{$data.cash_count}</td>
<td class="coin-detail" data-pay_type="0" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/gameCoinDetail',array_merge(I('get.'),['pay_way'=>0,'promote_type'=>1,'promote_id'=>$data['p_id'],p=>1,row=>10]))}">
@ -248,7 +248,7 @@
</div>
<div class="page">
<a class="sch-btn"
href="{:U('Export/expUser',array_merge(['id'=>3,'xlsname'=>'玩家_玩家列表_'.(I('get.type')==2?'第三方玩家':'本站玩家')],I('get.')))}">导出</a>
href="{:U('FinancePromote/index',array_merge(['export'=>1],I('get.')))}">导出</a>
{$_page|default=''}
</div>

@ -199,8 +199,8 @@
<volist name="list_data" id="data">
<tr>
<td>{$data.company_name}</td>
<td>{:get_promote_name($data['promote_id'])}</td>
<td>{$data['promote_account']}</td>
<td>{$data.cash_count}</td>
<td>{$data.balance_coin_count}</td>
<td>{$data.bind_coin_count}</td>

Loading…
Cancel
Save