From 7657db3b180ed9dbd3c89720af56b9f7f6a9cf03 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 6 Feb 2020 15:05:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E5=88=86=E7=B1=BB-=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E6=B8=A0=E9=81=93/=E6=94=AF=E4=BB=98=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialSummarySetController.class.php | 145 ++++++++++++++++-- 1 file changed, 136 insertions(+), 9 deletions(-) diff --git a/Application/Admin/Controller/FinancialSummarySetController.class.php b/Application/Admin/Controller/FinancialSummarySetController.class.php index 595435e80..a71d04f64 100644 --- a/Application/Admin/Controller/FinancialSummarySetController.class.php +++ b/Application/Admin/Controller/FinancialSummarySetController.class.php @@ -96,8 +96,8 @@ class FinancialSummarySetController extends \Think\Controller $this->setIncomeMoney(); //按合作方类型 $this->setPromoteMoney(); - // // //执行月份统计 - // $this->setMonthCount(); + //支付渠道/支付类型 + $this->setPayWayMoney(); //执行 dump($this->adddata); $this->model->commit(); @@ -284,11 +284,138 @@ class FinancialSummarySetController extends \Think\Controller "sum_money"=>number_format($outer_nobind_count/100, 2, '.', '') ); } - - - - - - - + /** + * 获取类型为4,5的数据/按支付渠道类型,支付类型类型 + */ + public function setPayWayMoney() + { + $moneyarry=[ + "wx"=>0, + "zfb"=>0, + "gfzfb"=>0, + "sqzfb"=>0, + "sqkj"=>0 + ]; + $this->getSpendPayWay($moneyarry); + $this->getGameSupersignPayWay($moneyarry); + $this->getDepositPayWay($moneyarry); + $this->getCoinPayOrderPayWay($moneyarry); + //统计数据 + $moneyarry['zfb'] = ($moneyarry['gfzfb']-0+$moneyarry['sqzfb']); + $this->adddata[] = array( + "key_name"=>'gfwx_count', + "type"=>4,"sort"=>1,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($moneyarry['wx']/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'gfzfb_count', + "type"=>4,"sort"=>2,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($moneyarry['gfzfb']/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'sqzfb_count', + "type"=>4,"sort"=>3,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($moneyarry['sqzfb']/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'sqkj_count', + "type"=>4,"sort"=>4,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($moneyarry['sqkj']/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'wx_count', + "type"=>5,"sort"=>1,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($moneyarry['wx']/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'zfb_count', + "type"=>5,"sort"=>2,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($moneyarry['zfb']/100, 2, '.', '') + ); + $this->adddata[] = array( + "key_name"=>'kj_count', + "type"=>5,"sort"=>3,"count_month"=>$this->month,"count_year"=>$this->year,"create_time"=>$this->nowdata, + "sum_money"=>number_format($moneyarry['sqkj']/100, 2, '.', '') + ); + } + //获取spend表 + protected function getSpendPayWay(&$moneyarry){ + $map = array( + "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "pay_status"=>1, + "pay_way"=>array("IN","1,2,3,9,15") + ); + $dbres=$this->SpendModel + ->field(" + IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_amount ELSE 0 END),0) as wxsm_count, + IFNULL(SUM(CASE WHEN pay_way = 3 THEN pay_amount ELSE 0 END),0) as wxapp_count, + IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_amount ELSE 0 END),0) as zfbgf_count, + IFNULL(SUM(CASE WHEN pay_way = 9 THEN pay_amount ELSE 0 END),0) as zfbsq_count, + IFNULL(SUM(CASE WHEN pay_way = 15 THEN pay_amount ELSE 0 END),0) as kjsq_count + ") + ->where($map) + ->find(); + $moneyarry['wx'] += ($dbres['wxsm_count']*100+$dbres['wxapp_count']*100); + $moneyarry['gfzfb'] += $dbres['zfbgf_count']*100; + $moneyarry['sqzfb'] += $dbres['zfbsq_count']*100; + $moneyarry['sqkj'] += $dbres['kjsq_count']*100; + } + //获取超级签购买 + protected function getGameSupersignPayWay(&$moneyarry) + { + $map = array( + "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "pay_status"=>1 + ); + $dbres=$this->GameSupersignModel + ->field(" + IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_price ELSE 0 END),0) as wx_count, + IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_price ELSE 0 END),0) as zfb_count + ") + ->where($map) + ->find(); + $moneyarry['wx'] += $dbres['wx_count']; + $moneyarry['gfzfb'] += $dbres['zfb_count']; + } + //玩家购买平台币 + protected function getDepositPayWay(&$moneyarry) + { + $map = array( + "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "pay_status"=>1, + "pay_way"=>array("IN","1,2,3,9,15") + ); + $dbres=$this->DepositModel + ->field(" + IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_amount ELSE 0 END),0) as wxsm_count, + IFNULL(SUM(CASE WHEN pay_way = 3 THEN pay_amount ELSE 0 END),0) as wxapp_count, + IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_amount ELSE 0 END),0) as zfbgf_count, + IFNULL(SUM(CASE WHEN pay_way = 9 THEN pay_amount ELSE 0 END),0) as zfbsq_count, + IFNULL(SUM(CASE WHEN pay_way = 15 THEN pay_amount ELSE 0 END),0) as kjsq_count + ") + ->where($map) + ->find(); + $moneyarry['wx'] += ($dbres['wxsm_count']*100+$dbres['wxapp_count']*100); + $moneyarry['gfzfb'] += $dbres['zfbgf_count']*100; + $moneyarry['sqzfb'] += $dbres['zfbsq_count']*100; + $moneyarry['sqkj'] += $dbres['kjsq_count']*100; + } + //会长充值平台币 + protected function getCoinPayOrderPayWay(&$moneyarry) + { + $map= array( + "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "order_status"=>array("EGT",1) + ); + $dbres= $this->CoinPayOrderModel + ->field(" + IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_amount ELSE 0 END),0) as wx_count, + IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_amount ELSE 0 END),0) as zfb_count + ") + ->where($map) + ->find(); + $moneyarry['wx'] += $dbres['wx_count']; + $moneyarry['gfzfb'] += $dbres['zfb_count']; + } + }