@ -65,6 +65,7 @@ class PayChannelController extends ThinkController
//平台币充值金额计算
//平台币充值金额计算
$coinMap['pay_source'] = 2;
$coinMap['pay_source'] = 2;
$coinMap['extend'] = array('eq','');
$coinMap['extend'] = array('eq','');
$coinMap['tab_deposit.pay_way'] = array('egt',1);
// setPowerPromoteIds($coinMap,'tab_deposit.promote_id');
// setPowerPromoteIds($coinMap,'tab_deposit.promote_id');
$coinData = M('pay_info','tab_')
$coinData = M('pay_info','tab_')
@ -74,12 +75,11 @@ class PayChannelController extends ThinkController
->group("game_id")
->group("game_id")
->select();
->select();
unset($coinMap['game_id']);
// unset($coinMap['game_id']);
//平台币充值
//平台币充值
$coinSum = M('deposit','tab_')
$coinSum = M('deposit','tab_')
->where($coinMap)
->where($coinMap)
->sum('tab_deposit.pay_amount');
->sum('tab_deposit.pay_amount');
// var_dump($coinSum);die();
$data = array_merge($data,$coinData);
$data = array_merge($data,$coinData);
$data = $this->unique_multi_array($data,'game_id');
$data = $this->unique_multi_array($data,'game_id');
@ -177,7 +177,7 @@ class PayChannelController extends ThinkController
// setPowerPromoteIds($spreadMap,'promote_id');
// setPowerPromoteIds($spreadMap,'promote_id');
//推广后台
//推广后台
$spreadData = M("coin_pay_order","tab_")
$spreadData = M("coin_pay_order","tab_")
->field("0 as game_name,sum(real _amount) as pay_amount,0 as platform_coin,id as test_coin")
->field("0 as game_name,sum(pay _amount) as pay_amount,0 as platform_coin,id as test_coin")
->where($spreadMap)
->where($spreadMap)
->find();
->find();
$spreadData['pay_amount'] = $spreadData['pay_amount']?$spreadData['pay_amount']:0;
$spreadData['pay_amount'] = $spreadData['pay_amount']?$spreadData['pay_amount']:0;
@ -250,11 +250,18 @@ class PayChannelController extends ThinkController
}
}
//汇总数据
//汇总数据
if ($_REQUEST['game_id']) {
$sumData['platform_coin'] = $sumData['platform_coin'] - $sumData['test_platform_coin'];
$sumData['test_coin'] = $sumData['test_coin']+$sumData['test_platform_coin'];
$sumData['sum'] = $sumData['pay_amount'] +$sumData['test_coin'] + $sumData['platform_coin'];
} else {
$sumData['pay_amount'] = $sumData['pay_amount'] + $superSignData['pay_amount'] + $bindRechargeData['pay_amount'];
$sumData['pay_amount'] = $sumData['pay_amount'] + $superSignData['pay_amount'] + $bindRechargeData['pay_amount'];
$sumData['platform_coin'] = $sumData['platform_coin'] - $sumData['test_platform_coin'] +
$sumData['platform_coin'] = $sumData['platform_coin'] - $sumData['test_platform_coin'] +
$offcialData['pay_amount'] + $spreadData['pay_amount'];
$offcialData['pay_amount'] + $spreadData['pay_amount'];
$sumData['test_coin'] = $sumData['test_coin']+$offcialTestCost+$testSuperSignCost+$sumData['test_platform_coin'];
$sumData['test_coin'] = $sumData['test_coin']+$offcialTestCost+$testSuperSignCost+$sumData['test_platform_coin'];
$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;
}
if($_REQUEST['export'] == 1) {
if($_REQUEST['export'] == 1) {
@ -276,7 +283,7 @@ class PayChannelController extends ThinkController
$payTypeDataExport['pay_amount'] .= $key.': '.$value." ";
$payTypeDataExport['pay_amount'] .= $key.': '.$value." ";
}
}
}
}
$payTypeDataExport['pay_amount'] .= "平台币直充金额(2019.12.18号以前的不显示在列表中,此项也不计入充值方式统计): ".
$payTypeDataExport['pay_amount'] .= "平台币直充总 金额(2019.12.18号以前的不显示在列表中,此项也不计入充值方式统计): ".
($coinSum + $offcialData['pay_amount'] + $spreadData['pay_amount']+$offcialTestCost);
($coinSum + $offcialData['pay_amount'] + $spreadData['pay_amount']+$offcialTestCost);
$channelDataExport['game_name'] = '支付渠道';
$channelDataExport['game_name'] = '支付渠道';
@ -288,6 +295,12 @@ class PayChannelController extends ThinkController
unset($sumData['test_platform_coin']);
unset($sumData['test_platform_coin']);
if ($_REQUEST['game_id']) {
unset($superSignData);
unset($offcialData);
unset($spreadData);
}
db2csv(array_merge(array_merge(array_merge(array_merge(
db2csv(array_merge(array_merge(array_merge(array_merge(
array_merge(array_merge(
array_merge(array_merge(
array_merge($data,[0=>$superSignData]),[0=>$offcialData])),[0=>$spreadData],[0=>$sumData])),[0=>$payTypeDataExport]),[0=>$channelDataExport]),'支付渠道统计导出',$title);
array_merge($data,[0=>$superSignData]),[0=>$offcialData])),[0=>$spreadData],[0=>$sumData])),[0=>$payTypeDataExport]),[0=>$channelDataExport]),'支付渠道统计导出',$title);
@ -296,8 +309,9 @@ 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);
//平台币直充金额,下面列表
//平台币直充金额,下面列表
$this->assign('coinSum',$coinSum + $offcialData['pay_amount'] + $spreadData['pay_amount']+$offcialTestCost );
$this->assign('coinSum',$coinSum);
$this->assign('sumData',$sumData);
$this->assign('sumData',$sumData);
$this->assign('channelData',$channelData);
$this->assign('channelData',$channelData);
@ -374,6 +388,26 @@ class PayChannelController extends ThinkController
->where($map)
->where($map)
->group('pay_way')
->group('pay_way')
->select(false);
->select(false);
if ($_REQUEST['game_id']) {
if ($map['pay_way']) {
$map['tab_deposit.pay_way'] = $map['pay_way'];
unset($map['pay_way']);
}
if ($map['create_time']) {
$map['tab_deposit.create_time'] = $map['create_time'];
unset($map['create_time']);
}
$map['tab_deposit.pay_source'] = 2;
$map['tab_pay_info.extend'] = '';
$depositData = M('pay_info','tab_')
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
->field('sum(pay_amount) as pay_amount,tab_deposit.pay_way as pay_way')
->where($map)
->group('tab_deposit.pay_way')
->select(false);
// var_dump($depositData);die();
}
$bindMap['pay_status'] = 1;
$bindMap['pay_status'] = 1;
$bindMap['pay_way'] = array('egt',1);
$bindMap['pay_way'] = array('egt',1);
@ -390,8 +424,14 @@ class PayChannelController extends ThinkController
->where($bindMap)
->where($bindMap)
->select(false);
->select(false);
if(!$_REQUEST['game_id']) {
$sql = "{$channelData} UNION ALL {$depositData} UNION ALL {$superSignDataPay} UNION ALL {$spreadDataPay} UNION ALL {$bindRechargeData}";
} else {
$sql = "{$channelData} UNION ALL {$depositData}";
}
//将语句整合起来查询
//将语句整合起来查询
$channelData = "select sum(pay_amount) as pay_amount,pay_way from ({$channelData} UNION ALL {$depositData} UNION ALL {$superSignDataPay} UNION ALL {$spreadDataPay} UNION ALL {$bindRechargeData})t group by pay_way;";
$channelData = "select sum(pay_amount) as pay_amount,pay_way from ({$sql })t group by pay_way;";
// var_dump($channelData);die();
// var_dump($channelData);die();
$channelData = M()->query($channelData);
$channelData = M()->query($channelData);
@ -482,7 +522,7 @@ class PayChannelController extends ThinkController
// setPowerPromoteIds($spreadMap,'promote_id');
// setPowerPromoteIds($spreadMap,'promote_id');
// $spreadMap['pay_way'] = array('egt',1);
// $spreadMap['pay_way'] = array('egt',1);
$coin_pay_order = M('coin_pay_order','tab_')
$coin_pay_order = M('coin_pay_order','tab_')
->field("pay_order_number,create_time as pay_time,promote_account,pay_amount as cost,real_amount as pay_amoun t,pay_way")
->field("pay_order_number,create_time as pay_time,promote_account,pay_amount,real_amount as cos t,pay_way")
->where($spreadMap)
->where($spreadMap)
->select(false);
->select(false);