From 56981a0accdd4520b0d44b1cd170bcaab5940e20 Mon Sep 17 00:00:00 2001
From: sunke <18850253506@163.com>
Date: Tue, 11 Feb 2020 12:05:57 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B8=A0=E9=81=93=E8=AE=A1=E7=AE=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controller/QueryController.class.php | 293 +++++++++++++++++-
Application/Admin/View/Query/detaillist.html | 149 +++++++++
Application/Admin/View/Query/marketList.html | 21 +-
3 files changed, 459 insertions(+), 4 deletions(-)
create mode 100644 Application/Admin/View/Query/detaillist.html
diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php
index 4f558fbcf..6e1f221d1 100644
--- a/Application/Admin/Controller/QueryController.class.php
+++ b/Application/Admin/Controller/QueryController.class.php
@@ -13,6 +13,21 @@ use Admin\Model\WithdrawModel;
*/
class QueryController extends ThinkController
{
+ public $pay_way_name = [ //无费率默认平台必 即是费率为0
+ '-1' => 'bind_pay', //绑币支付
+ '0' => 'ptb_pay', //平台币支付
+ '1' => 'alipay', //支付宝
+ '2' => 'wei_xin',
+ '3' => 'wei_xin',
+ '4' => 'weixin',
+ '5' => 'ptb_pay',
+ '6' => 'jft', //竣付通
+ '7' => 'ptb_pay',
+ '8' => 'ptb_pay',
+ '9' => 'sqpay', //双乾支付-支付宝
+ '10' => 'sqpay', //双乾支付-银联
+ '15' => 'sqpay', //双乾支付-快捷
+ ];
//生成提现单号
public function produceWithdrawNumber()
{
@@ -1562,8 +1577,57 @@ class QueryController extends ThinkController
$pagecount = M()->table('('.$count.') as a')->count();
foreach($data as $key => $value) {
-
-
+ $mytime = $value['my_time'];
+ $nextMonth = date('Y-m',strtotime("$mytime + 1 month"));
+ $game_id = $value['game_id'];
+ $gameInfo = M('game','tab_')->where(['id'=>$game_id])->getField('game_name');
+ $gameName = substr($gameInfo,0,strpos($gameInfo,'('));
+ $gameMap['game_name'] = ['like','%'.$gameName.'%'];
+ $gameIdArr = M('game','tab_')->field('id')->where($gameMap)->select();
+ $gameNameIdArr = [];
+ foreach($gameIdArr as $gameKey => $gameValue){
+ $gameNameIdArr[] = $gameValue['id'];
+ }
+ $promote_id = $value['promote_id'];
+ $pay_status = 1;
+ $promoteInfo = M('promote','tab_')->where(['id'=>$promote_id])->find();
+ $level = $promoteInfo['level'];
+ if($promote_id != 0) {
+ if ($level == 1) {
+ $rootPromoteId = $promote_id;
+ $where['promote_id'] = $promote_id;
+ }else {
+ $chain = $promoteInfo['chain'];
+ $chainArr = explode('/',$chain);
+ $rootPromoteId = $chainArr[1];
+ $where1['chain'] = array('like', '%/' . $rootPromoteId. '/%');
+ $promoteIdInfo = M('promote','tab_')->field('id')->where($where1)->select();
+ $promoteIdArr = [];
+ foreach($promoteIdInfo as $key2 => $v1) {
+ $promoteIdArr[] = $v1['id'];
+ }
+ $where['promote_id'] = ['in',$promoteIdArr];
+ }
+
+ }else {
+ $where['promote_id'] = 0;
+ }
+
+
+ $where['game_id'] = ['in',$gameNameIdArr];
+ $where['pay_status'] = 1;
+ $begTime = strtotime($mytime);
+ $endTime = strtotime($nextMonth);
+ $where['pay_time'] = ['between',[$begTime,$endTime]];
+ $spendInfo = M('spend','tab_')->field('pay_amount,pay_way')->where($where)->select();
+ $initNum = 0;
+ foreach($spendInfo as $key1 => $spendValue) {
+ $pay_way = $spendValue['pay_way'];
+ $channel_rate = $this->getChannelConfig($pay_way) / 100;
+ $initNum += $spendValue['pay_amount'] * $channel_rate;
+
+ }
+ $data[$key]['pay_amount'] = $value['pay_amount'] - $initNum;
// if ($value['games_ratio']) {
// $data[$key]['upstream'] = $value['pay_amount'] * ($value['games_ratio']*0.01);
// } else {
@@ -1802,4 +1866,229 @@ class QueryController extends ThinkController
$this->display('auto_review');
}
}
+
+ public function getChannelConfig($pay_way = 0,$config=false) {
+ if(!$config) {
+ $payWayName = $this->pay_way_name[$pay_way];
+ $toolConfig = M('tool','tab_')->where(['name'=>$payWayName])->find();
+ $config = json_decode($toolConfig['config'],true);
+ if(empty($config['channel_rate'])){
+ $channel_rate = 0;
+ }else {
+ $channel_rate = $config['channel_rate'];
+ }
+
+ }else {
+ foreach($this->pay_way_name as $key => $value) {
+ $name = $value;
+ $toolConfig = M('tool','tab_')->where(['name'=>$name])->find();
+ $config = json_decode($toolConfig['config'],true);
+ if(empty($config['channel_rate'])){
+ $channel_rate[$key] = 0;
+ }else {
+ $channel_rate[$key] = $config['channel_rate'];
+ }
+ }
+ }
+
+ return $channel_rate;
+
+ }
+
+ public function detailList($p = 1) {
+ $mytime = $_REQUEST['my_time'];
+ $nextMonth = date('Y-m',strtotime("$mytime + 1 month"));
+ $game_id = $_REQUEST['game_id'];
+ $gameInfo = M('game','tab_')->where(['id'=>$game_id])->getField('game_name');
+ $gameName = substr($gameInfo,0,strpos($gameInfo,'('));
+ $gameMap['game_name'] = ['like','%'.$gameName.'%'];
+ $gameIdArr = M('game','tab_')->field('id')->where($gameMap)->select();
+ $gameNameIdArr = [];
+ foreach($gameIdArr as $gameKey => $gameValue){
+ $gameNameIdArr[] = $gameValue['id'];
+ }
+ $promote_id = $_REQUEST['promote_id'];
+ $promoteInfo = M('promote','tab_')->where(['id'=>$promote_id])->find();
+ $level = $promoteInfo['level'];
+ if($promote_id != 0) {
+ if ($level == 1) {
+ $rootPromoteId = $promote_id;
+ $map['promote_id'] = $promote_id;
+ }else {
+ $chain = $promoteInfo['chain'];
+ $chainArr = explode('/',$chain);
+ $rootPromoteId = $chainArr[1];
+ $where1['chain'] = array('like', '%/' . $rootPromoteId. '/%');
+ $promoteIdInfo = M('promote','tab_')->field('id')->where($where1)->select();
+ $promoteIdArr = [];
+ foreach($promoteIdInfo as $key2 => $v1) {
+ $promoteIdArr[] = $v1['id'];
+ }
+ $map['promote_id'] = ['in',$promoteIdArr];
+ }
+
+ }else {
+ $map['promote_id'] = 0;
+ }
+ $pay_status = 1;
+ $map['game_id'] = ['in',$gameNameIdArr];
+ // $map['promote_id'] = ['in',$promoteIdArr];
+ $map['pay_status'] = 1;
+ $begTime = strtotime($mytime);
+ $endTime = strtotime($nextMonth);
+ $map['pay_time'] = ['between',[$begTime,$endTime]];
+
+ $spendInfo = M('spend','tab_')->field('pay_amount,pay_way')->where($map)->select();
+ $initZfbNum = 0;
+ $initWxsmNum = 0;
+ $initWxNum = 0;
+ $initPlatformCoinNum = 0;
+ $initBindNum = 0;
+ $initSqNum = 0;
+ $initWftNum = 0;
+ $initJbyNum = 0;
+ $initJftNum = 0;
+ $initappleNum = 0;
+ $initJzNum = 0;
+ $initSqzfbNum = 0; //双乾支付-支付宝
+ $initSqylNum = 0; //双乾支付-银联
+ $initSqkjNum = 0; // 双乾支付-快捷
+ $initZfbNumTotal = 0;
+ $initWxsmNumTotal = 0;
+ $initWxNumTotal = 0;
+ $initPlatformCoinNumTotal = 0;
+ $initBindNumTotal = 0;
+ $initSqNumTotal = 0;
+ $initWftNumTotal = 0;
+ $initJbyNumTotal = 0;
+ $initJftNumTotal = 0;
+ $initappleNumTotal = 0;
+ $initJzNumTotal = 0;
+ $initSqzfbNumTotal = 0; //双乾支付-支付宝
+ $initSqylNumTotal = 0; //双乾支付-银联
+ $initSqkjNumTotal = 0; // 双乾支付-快捷
+ $detailInfoTotal = [];
+ foreach($spendInfo as $key => $value) {
+ $pay_way = $value['pay_way'];
+ $pay_amount = $value['pay_amount'];
+ $channel_rate = $this->getChannelConfig($pay_way) / 100;
+ switch($pay_way) {
+ case -1:
+ $initBindNumTotal += $pay_amount ; //总流水
+ $initBindNum += $channel_rate * $pay_amount; //总扣费
+ $afterBindNum = $initBindNumTotal - $initBindNum;
+ break;
+ case 0:
+ $initPlatformCoinNumTotal += $pay_amount ;
+ $initPlatformCoinNum += $channel_rate * $pay_amount;
+ $afterPlatformCoinNum = $initPlatformCoinNumTotal - $initPlatformCoinNum;
+ break;
+ case 1:
+ $initZfbNumTotal += $pay_amount ;
+ $initZfbNum += $channel_rate * $pay_amount;
+ $afterZfbNum = $initZfbNumTotal - $initZfbNum;
+ break;
+ case 2:
+ $initWxsmNumTotal += $pay_amount ;
+ $initWxsmNum += $channel_rate * $pay_amount;
+ $afterWxsmNum = $initWxsmNumTotal - $initWxsmNum;
+ break;
+ case 3:
+ $initWxNumTotal += $pay_amount ;
+ $initWxNum += $channel_rate * $pay_amount;
+ $afterWxNum = $initWxNumTotal - $initWxNum;
+ break;
+ case 4:
+ $initWftNumTotal += $pay_amount ;
+ $initWftNum += $channel_rate * $pay_amount;
+ $afterWftNum = $initWftNumTotal - $initWftNum;
+ break;
+ case 5:
+ $initJbyNumTotal += $pay_amount ;
+ $initJbyNum += $channel_rate * $pay_amount;
+ $afterJbyNum = $initJbyNumTotal - $initJbyNum;
+ break;
+ case 6:
+ $initJftNumTotal += $pay_amount ;
+ $initJftNum += $channel_rate * $pay_amount;
+ $afterJftNum = $initJftNumTotal - $initJftNum;
+ break;
+ case 7:
+ $initappleNumTotal += $pay_amount;
+ $initappleNum += $channel_rate * $pay_amount;
+ $afterappleNum = $initappleNumTotal - $initappleNum;
+ break;
+ case 8:
+ $initJzNumTotal += $pay_amount;
+ $initJzNum += $channel_rate * $pay_amount;
+ $afterappleNum = $initappleNumTotal - $initappleNum;
+ break;
+ case 9:
+ $initSqzfbNumTotal += $pay_amount;
+ $initSqzfbNum += $channel_rate * $pay_amount;
+ $afterSqzfbNum = $initSqzfbNumTotal - $initSqzfbNum;
+ break;
+ case 10:
+ $initSqylNumTotal += $pay_amount;
+ $initSqylNum += $channel_rate * $pay_amount;
+ $afterSqylNum = $initSqylNumTotal - $initSqylNum;
+ break;
+ case 15:
+ $initSqkjNumTotal += $pay_amount;
+ $initSqkjNum += $channel_rate * $pay_amount;
+ $afterSqkjNum = $initSqkjNumTotal - $initSqkjNum;
+ break;
+ default:
+ break;
+ }
+
+ }
+ $detailInfoTotal['bindtotal'] = $initBindNumTotal;
+ $detailInfoTotal['platformcointotal'] = $initPlatformCoinNumTotal;
+ $detailInfoTotal['zfbtotal'] = $initZfbNumTotal;
+ $detailInfoTotal['wxsmtotal'] = $initWxsmNumTotal;
+ $detailInfoTotal['wxtotal'] = $initWxNumTotal;
+ $detailInfoTotal['wfttotal'] = $initWftNumTotal;
+ $detailInfoTotal['jbytotal'] = $initJbyNumTotal;
+ $detailInfoTotal['jfttotal'] = $initJftNumTotal;
+ $detailInfoTotal['appletotal'] = $initappleNumTotal;
+ $detailInfoTotal['jztotal'] = $initJzNumTotal;
+ $detailInfoTotal['sqzfbtotal'] = $initSqzfbNumTotal;
+ $detailInfoTotal['sqyltotal'] = $initSqylNumTotal;
+ $detailInfoTotal['sqkjtotal'] = $initSqkjNumTotal;
+
+
+ $detailInfoTotal['bind'] = $initBindNum;
+ $detailInfoTotal['platformcoin'] = $initPlatformCoinNum;
+ $detailInfoTotal['zfb'] = $initZfbNum;
+ $detailInfoTotal['wxsm'] = $initWxsmNum;
+ $detailInfoTotal['wx'] = $initWxNum;
+ $detailInfoTotal['wft'] = $initWftNum;
+ $detailInfoTotal['jby'] = $initJbyNum;
+ $detailInfoTotal['jft'] = $initJftNum;
+ $detailInfoTotal['apple'] = $initappleNum;
+ $detailInfoTotal['jz'] = $initJzNum;
+ $detailInfoTotal['sqzfb'] = $initSqzfbNum;
+ $detailInfoTotal['sqyl'] = $initSqylNum;
+ $detailInfoTotal['sqkj'] = $initSqkjNum;
+
+ $detailInfoTotal['afterbind'] = $afterBindNum;
+ $detailInfoTotal['afterplatformcoin'] = $afterPlatformCoinNum;
+ $detailInfoTotal['afterzfb'] = $afterZfbNum;
+ $detailInfoTotal['afterwxsm'] = $afterWxsmNum;
+ $detailInfoTotal['afterwx'] = $afterWxNum;
+ $detailInfoTotal['afterwft'] = $afterWftNum;
+ $detailInfoTotal['afterjby'] = $afterJbyNum;
+ $detailInfoTotal['afterjft'] = $afterJftNum;
+ $detailInfoTotal['afterapple'] = $afterappleNum;
+ $detailInfoTotal['afterjz'] = $afterJzNum;
+ $detailInfoTotal['aftersqzfb'] = $afterSqzfbNum;
+ $detailInfoTotal['aftersqyl'] = $afterSqylNum;
+ $detailInfoTotal['aftersqkj'] = $afterSqkjNum;
+
+ $rateCon = $this->getChannelConfig(0,true);
+ $this->assign('ratecon',$rateCon);
+ $this->assign('data', $detailInfoTotal);
+ $this->display();
+ }
}
diff --git a/Application/Admin/View/Query/detaillist.html b/Application/Admin/View/Query/detaillist.html
new file mode 100644
index 000000000..c7c466832
--- /dev/null
+++ b/Application/Admin/View/Query/detaillist.html
@@ -0,0 +1,149 @@
+
+
+
+
+
+
+ 渠道详情
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 支付渠道 |
+ 渠道费率(%) |
+ 总流水 |
+ 渠道费 |
+ 扣除渠道费用后流水 |
+
+
+
+
+
+
+
+ 绑币 |
+ {$ratecon['-1']} |
+ {$data.bindtotal} |
+ {$data.bind} |
+ {$data.afterbind} |
+
+
+
+ 平台币 |
+ {$ratecon['0']} |
+ {$data.platformcointotal} |
+ {$data.platformcoin} |
+ {$data.afterplatformcoin} |
+
+
+ 支付宝 |
+ {$ratecon['1']} |
+ {$data.zfbtotal} |
+ {$data.zfb} |
+ {$data.afterzfb} |
+
+
+ 微信(扫码) |
+ {$ratecon['2']} |
+ {$data.wxsmtotal} |
+ {$data.wxsm} |
+ {$data.afterwxsm} |
+
+
+ 微信app |
+ {$ratecon['3']} |
+ {$data.wxtotal} |
+ {$data.wx} |
+ {$data.afterwx} |
+
+
+ 威富通 |
+ {$ratecon['4']} |
+ {$data.wfttotal} |
+ {$data.wft} |
+ {$data.afterwft} |
+
+
+ 聚宝云 |
+ {$ratecon['5']} |
+ {$data.jbytotal} |
+ {$data.jby} |
+ {$data.afterjby} |
+
+
+ 竣付通 |
+ {$ratecon['6']} |
+ {$data.jfttotal} |
+ {$data.jft} |
+ {$data.afterjft} |
+
+
+ 苹果支付 |
+ {$ratecon['7']} |
+ {$data.appletotal} |
+ {$data.apple} |
+ {$data.afterapple} |
+
+
+ 金猪支付 |
+ {$ratecon['8']} |
+ {$data.jztotal} |
+ {$data.jz} |
+ {$data.afterjz} |
+
+
+ 双乾支付-支付宝 |
+ {$ratecon['9']} |
+ {$data.sqzfbtotal} |
+ {$data.sqzfb} |
+ {$data.aftersqzfb} |
+
+
+ 双乾支付-银联 |
+ {$ratecon['10']} |
+ {$data.sqyltotal} |
+ {$data.sqyl} |
+ {$data.aftersqyl} |
+
+
+ 双乾支付-快捷 |
+ {$ratecon['15']} |
+ {$data.sqkjtotal} |
+ {$data.sqkj} |
+ {$data.aftersqkj} |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Application/Admin/View/Query/marketList.html b/Application/Admin/View/Query/marketList.html
index 0f240b493..78188596f 100644
--- a/Application/Admin/View/Query/marketList.html
+++ b/Application/Admin/View/Query/marketList.html
@@ -134,7 +134,7 @@
内外团 |
归属类型 |
游戏名称 |
- 总流水 |
+ 扣除渠道费后总流水 |
上游结算流水 |
下游结算流水 |
绩优流水 |
@@ -156,7 +156,7 @@
{$data.company_belong} |
{$data.company_relation} |
{$data.game_names} |
- {$data.pay_amount} |
+ {$data.pay_amount} |
{$data.upstream} |
{$data.downstream} |
{$data.highquality} |
@@ -250,6 +250,23 @@
+
+
+