@ -59,7 +59,7 @@ class PayChannelController extends ThinkController
//游戏币计算
//游戏币计算
$data = M('spend use index(pay_channel)','tab_')
$data = M('spend use index(pay_channel)','tab_')
->field("game_name,sum(pay_amount) as pay_amount,game_id")
->field("game_name,sum(pay_amount) as pay_amount,game_id,sdk_version ")
->where($map)
->where($map)
->group('game_id')
->group('game_id')
->order('pay_amount desc')
->order('pay_amount desc')
@ -73,7 +73,7 @@ class PayChannelController extends ThinkController
$coinData = M('pay_info','tab_')
$coinData = M('pay_info','tab_')
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
->field("tab_pay_info.game_name,0 as pay_amount,sum(tab_deposit.pay_amount) as platform_coin,0 as test_coin,tab_pay_info.game_id")
->field("tab_pay_info.game_name,0 as pay_amount,sum(tab_deposit.pay_amount) as platform_coin,0 as test_coin,tab_pay_info.game_id,tab_pay_info.sdk_version ")
->where($coinMap)
->where($coinMap)
->group("game_id")
->group("game_id")
->select();
->select();
@ -125,7 +125,8 @@ class PayChannelController extends ThinkController
$data[$key]['platform_coin'] = $handleCoinData[$value['game_id']]?$handleCoinData[$value['game_id']]:0;
$data[$key]['platform_coin'] = $handleCoinData[$value['game_id']]?$handleCoinData[$value['game_id']]:0;
$data[$key]['test_coin'] = $handleTestData[$value['game_id']]?$handleTestData[$value['game_id']]:0;
$data[$key]['test_coin'] = $handleTestData[$value['game_id']]?$handleTestData[$value['game_id']]:0;
$data[$key]['test_platform_coin'] = $handleTestCoinData[$value['game_id']]?$handleTestCoinData[$value['game_id']]:0;
$data[$key]['test_platform_coin'] = $handleTestCoinData[$value['game_id']]?$handleTestCoinData[$value['game_id']]:0;
$data[$key]['game_name'] =clearGameNameType($data[$key]['game_name']);
$data[$key]['sdk_version'] =$data[$key]['sdk_version'] == 1 ? "安卓" : "苹果";
}
}
$superMap = $map;
$superMap = $map;
// unset($superMap['promote_id']);
// unset($superMap['promote_id']);
@ -253,7 +254,7 @@ class PayChannelController extends ThinkController
$this->assign('_page', $page);
$this->assign('_page', $page);
}
}
$sumData['game'] = '汇总';
$sumData['game_name '] = '汇总';
$sumData['pay_amount'] = 0;
$sumData['pay_amount'] = 0;
$sumData['platform_coin'] = 0;
$sumData['platform_coin'] = 0;
$sumData['test_coin'] = 0;
$sumData['test_coin'] = 0;
@ -291,37 +292,58 @@ class PayChannelController extends ThinkController
$sumData['sum'] = $sumData['pay_amount'] +$sumData['test_coin'] + $sumData['platform_coin'];
$sumData['sum'] = $sumData['pay_amount'] +$sumData['test_coin'] + $sumData['platform_coin'];
$coinSum = $coinSum + $offcialData['pay_amount'] + $spreadData['pay_amount']+$offcialTestCost;
$coinSum = $coinSum + $offcialData['pay_amount'] + $spreadData['pay_amount']+$offcialTestCost;
}
}
$sum_pay_amount = M('test_order', 'tab_')->where($maptestorder)->field('sum(pay_amount) as sum_order_amount')->find();
$moneyAllCount = array_sum(array_column($channelData, 'pay_amount'));
if($_REQUEST['export'] == 1) {
if($_REQUEST['export'] == 1) {
$title = array('产品名称','游戏现金金额','平台币直冲金额','测试金额','支付渠道内合计');
$title = array('产品名称','游戏现金金额','平台币直冲金额','测试金额','支付渠道内合计');
$superSignData['game_name'] = '超级签';
$superSignData['game_name'] = '超级签';
$superSignData['platform_coin'] = '0';
$superSignData['sdk_version'] = '';
$offcialData['game_name'] = '官网';
$offcialData['game_name'] = '官网';
$spreadData['game_name'] = '推广后台';
$offcialData['platform_coin'] = $offcialData['pay_amount'];
$offcialData['pay_amount'] = "0";
$offcialData['sdk_version'] = "";
$superSignData['platform_coin'] = '0';
$offcialData['platform_coin'] = '0';
$spreadData['game_name'] = '推广后台';
$spreadData['platform_coin'] = '0';
$spreadData['platform_coin'] = $spreadData['pay_amount'];
$spreadData['pay_amount'] = '0';
$spreadData['test_coin'] = '0';
$spreadData['test_coin'] = '0';
$spreadData['sdk_version'] = '';
$sumData['sdk_version'] = '';
$testOrder["game_name"] = "测试环境内外网平台";
$testOrder["sdk_version"] = "";
$testOrder["pay_amount"] =$sum_pay_amount['sum_order_amount'] ?: "0";
$testOrder["platform_coin"] ="0";
$testOrder['test_coin'] = '0';
$testOrder['sum'] = $sum_pay_amount['sum_order_amount'] ?: "0";
//充值方式统计
//充值方式统计
$payTypeDataExport['game_name'] = '充值方式统计';
$payTypeDataExport['game_name'] = '充值方式统计';
foreach($payTypeData as $key => $value) {
foreach($payTypeData as $key => $value) {
if ($value) {
if ($value) {
$payTypeDataExport['pay_amount'] .= $key.': '.$value." ";
$payTypeDataExport['sdk_version '] .= $key.': '.$value." ";
}
}
}
}
$payTypeDataExport['pay_amount'] .= "平台币直充总金额(2019.12.18号以前的不显示在列表中,此项也不计入充值方式统计): ".
$payTypeDataExport['sdk_version '] .= "平台币直充总金额(2019.12.18号以前的不显示在列表中,此项也不计入充值方式统计): ".
($coinSum);
($coinSum);
$channelDataExport['game_name'] = '支付渠道';
$channelDataExport['game_name'] = '支付渠道';
$channelDataExport2['game_name'] = '支付渠道占比';
foreach($channelData as $key => $value) {
foreach($channelData as $key => $value) {
if ($value) {
if ($value) {
$channelDataExport['pay_amount'] .= $value['pay_way'].': '.$value['pay_amount']." ";
$channelDataExport['sdk_version'] .= $value['pay_way'].': '.$value['pay_amount']." ";
$channelDataExport2['sdk_version'] .= $value['pay_way'].': '.round($value['pay_amount']*100/ $moneyAllCount,2)."% ";
}
}
}
}
unset($sumData['test_platform_coin']);
unset($sumData['test_platform_coin']);
if ($_REQUEST['game_id']) {
if ($_REQUEST['game_id']) {
@ -333,10 +355,9 @@ class PayChannelController extends ThinkController
$GetData = $_GET;
$GetData = $_GET;
unset($GetData['export']);
unset($GetData['export']);
addOperationLog(['op_type'=>3,'key'=>getNowDate(),'url'=>U(CONTROLLER_NAME.'/'.ACTION_NAME,$GetData),'menu'=>"充值-财务管理-支付渠道查看-导出"]);
addOperationLog(['op_type'=>3,'key'=>getNowDate(),'url'=>U(CONTROLLER_NAME.'/'.ACTION_NAME,$GetData),'menu'=>"充值-财务管理-支付渠道查看-导出"]);
//处理导出数据
db2csv(array_merge(array_merge(array_merge(array_merge(
data2csv(array_merge($data,[$superSignData],[$offcialData],[$spreadData],[$sumData],[$testOrder],[$payTypeDataExport],[$channelDataExport],[$channelDataExport2]),"支付渠道统计导出",array(
array_merge(array_merge(
"game_name"=>"产品名称","sdk_version"=>"设备名称","pay_amount"=>"游戏现金金额","platform_coin"=>"平台币直冲金额","test_coin"=>"测试金额","sum"=>"支付渠道内合计"));
array_merge($data,[0=>$superSignData]),[0=>$offcialData])),[0=>$spreadData],[0=>$sumData])),[0=>$payTypeDataExport]),[0=>$channelDataExport]),'支付渠道统计导出',$title);
}
}
@ -348,15 +369,15 @@ class PayChannelController extends ThinkController
$this->meta_title = "支付渠道统计";
$this->meta_title = "支付渠道统计";
$size = $row;//每页显示的记录数
$size = $row;//每页显示的记录数
$data = array_slice($data, ($arraypage - 1) * $size, $size);
$data = array_slice($data, ($arraypage - 1) * $size, $size);
$sum_pay_amount = M('test_order', 'tab_')->where($maptestorder)->field('sum(pay_amount) as sum_order_amount')->find();
//平台币直充金额,下面列表
//平台币直充金额,下面列表
$this->assign('coinSum',$coinSum);
$this->assign('coinSum',$coinSum);
$channelData2 = $channelData;
$channelData2 = $channelData;
$arr_merge = array_merge($channelData2,$testorderChannelArr);
$arr_merge = array_merge($channelData2,$testorderChannelArr);
$this->assign('sumData',$sumData);
$this->assign('sumData',$sumData);
$this->assign('channelData',$arr_merge);
$this->assign('channelData',$arr_merge);
$this->assign('listdata',$data);
$this->assign('listdata',$data);
//统计总额和比例
//统计总额和比例
$this->assign('channelData2',$channelData);
$this->assign('channelData2',$channelData);
$this->assign('sum_pay_amount',$sum_pay_amount);
$this->assign('sum_pay_amount',$sum_pay_amount);