支付渠道统计

master
sunke 5 years ago
parent 2ff97a4f41
commit 2ecb05d924

@ -22,31 +22,34 @@ class PayChannelController extends ThinkController
}
$map = [];
if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
$coinMap['tab_deposit.create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
$bindMap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
$offcialmap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
$spreadMap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
$maptestorder['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]);
} elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$map['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
$coinMap['tab_deposit.create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
$bindMap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
$offcialmap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
$spreadMap['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
$maptestorder['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]);
} elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) {
$map['pay_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
$coinMap['tab_deposit.create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
$bindMap['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
$offcialmap['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
$spreadMap['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
$maptestorder['pay_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399));
}
if (!empty($_REQUEST['game_id'])) {
$map['game_id'] = $_REQUEST['game_id'];
$bindMap['game_id'] = $_REQUEST['game_id'];
$coinMap['game_id'] = $_REQUEST['game_id'];
$maptestorder['game_id'] = $_REQUEST['game_id'];
}
$map['pay_status'] = $coinMap['pay_status'] = 1;
@ -186,7 +189,7 @@ class PayChannelController extends ThinkController
$this->assign('spreadData',$spreadData);
$channelData = $this->getPayChannel($map);
$testOrderChannelDatas = $this->getTestOrderPayChannel($maptestorder);
$payTypeData['支付宝支付金额'] = 0;
$payTypeData['微信支付金额'] = 0;
$payTypeData['快捷支付金额'] = 0;
@ -207,16 +210,36 @@ class PayChannelController extends ThinkController
}
$this->assign('payTypeData',$payTypeData);
$pay_way_arr = [];
foreach($channelData as $pay_way_key => $channelData_payway) {
$pay_way_arr[$pay_way_key] = $channelData_payway['pay_way'];
}
$testorderChannelArr = [];
foreach($channelData as $key=>$value) {
$channelData[$key]['pay_amount'] = number_format($value['pay_amount'],2,'.','');
$channelData[$key]['pay_way'] = get_pay_way($value['pay_way']);
foreach($testOrderChannelDatas as $trkey => $testOrderChannelData) {
if(intval($value['pay_way']) == intval($testOrderChannelData['pay_way'])) {
$channelData[$key]['pay_amount'] = number_format(($value['pay_amount'] + $testOrderChannelData['pay_amount']) ,2,'.','');
$channelData[$key]['pay_way'] = get_pay_way($value['pay_way']);
break;
}
else if (!in_array(intval($testOrderChannelData['pay_way']),$pay_way_arr)) {
// $channelData[$testOrderChannelData['pay_way']]['pay_amount'] = number_format($testOrderChannelData['pay_amount'],2,'.','');
$testorderChannelArr[$trkey]['pay_amount'] = number_format($testOrderChannelData['pay_amount'],2,'.','');
$testorderChannelArr[$trkey]['pay_way'] = get_pay_way($testOrderChannelData['pay_way']);
}
else {
$channelData[$key]['pay_amount'] = number_format($value['pay_amount'],2,'.','');
$channelData[$key]['pay_way'] = get_pay_way($value['pay_way']);
}
}
// $channelData[$key]['pay_way'] = get_pay_way($value['pay_way']);
if (!$value['pay_way']) {
unset($channelData[$key]);
}
}
$count = count($data);
$page = set_pagination($count, $row);
@ -249,7 +272,7 @@ class PayChannelController extends ThinkController
$sumData['test_platform_coin'] +=$handleTestCoinData[$value['game_id']]?$handleTestCoinData[$value['game_id']]:0;
}
//汇总数据
// 汇总数据
if ($_REQUEST['game_id']) {
$sumData['platform_coin'] = $sumData['platform_coin'] - $sumData['test_platform_coin'];
$sumData['test_coin'] = $sumData['test_coin']+$sumData['test_platform_coin'];
@ -313,15 +336,18 @@ class PayChannelController extends ThinkController
$this->meta_title = "支付渠道统计";
$size = $row;//每页显示的记录数
$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);
$channelData2 = $channelData;
$arr_merge = array_merge($channelData2,$testorderChannelArr);
$this->assign('sumData',$sumData);
$this->assign('channelData',$channelData);
$this->assign('listdata',$data);
$this->assign('sumData',$sumData);
$this->assign('channelData',$arr_merge);
$this->assign('listdata',$data);
//统计总额和比例
$this->assign('channelData2',$channelData);
$this->assign('sum_pay_amount',$sum_pay_amount);
$moneyAllCount = array_sum(array_column($channelData, 'pay_amount'));
$this->assign('moneyAllCount',$moneyAllCount);
$this->display();
@ -356,6 +382,26 @@ class PayChannelController extends ThinkController
}
public function add_array($array_1, $array_2) {
$array_merge = array_merge_recursive($array_1, $array_2);
foreach($array_merge as $key => $value) {
if(is_array($value))
$array_merge[$key] = array_sum($value);
}
return $array_merge;
}
public function getTestOrderPayChannel($map) {
$testOrderChannelData = M('test_order','tab_')
->field('sum(pay_amount) as pay_amount,pay_way')
->where($map)
->group('pay_way')
->select();
return $testOrderChannelData;
}
public function getPayChannel($map) {
//支付
//游戏订单渠道

@ -218,6 +218,16 @@
<a href="#" >------</a>
</td>
</tr>
<tr>
<td><span>测试环境内外网平台</span></td>
<td ><span><if condition="$sum_pay_amount.sum_order_amount neq ''">{$sum_pay_amount['sum_order_amount']}<else/>0</if></span></td>
<td><span>0</span></td>
<td>0</td>
<td><if condition="$sum_pay_amount['sum_order_amount'] neq ''">{$sum_pay_amount['sum_order_amount']}<else/>0</if></td>
<td>
<a href="{:U('TestOrder/lists')}" >订单查看</a>
</td>
</tr>
</notemtpy>
<tr>
<td><span>充值方式统计</span></td>

Loading…
Cancel
Save