From 98c8c7ee1e2cd6fb9f213552699bb23314dc7fbb Mon Sep 17 00:00:00 2001 From: chenzhi Date: Fri, 31 Jul 2020 10:44:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95=E6=9C=8D?= =?UTF-8?q?=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialSummarySetController.class.php | 55 +++++++++++++++---- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/Application/Admin/Controller/FinancialSummarySetController.class.php b/Application/Admin/Controller/FinancialSummarySetController.class.php index 717eafea6..41fc3138b 100644 --- a/Application/Admin/Controller/FinancialSummarySetController.class.php +++ b/Application/Admin/Controller/FinancialSummarySetController.class.php @@ -32,6 +32,8 @@ class FinancialSummarySetController extends \Think\Controller $this->SpendModel = M("Spend",'tab_'); $this->GameSupersignModel = M("GameSupersign",'tab_'); $this->CoinPayOrderModel = M("CoinPayOrder",'tab_');//会长充值平台币表 + $this->TestOrderModel = M("TestOrder",'tab_');//测试订单录入 + } @@ -85,16 +87,23 @@ class FinancialSummarySetController extends \Think\Controller if($countRes > 0){ die("error:Repeated statistics,msg:{$this->date}已经聚合过"); } - - //按收入类型 + echo "{$this->date}开始统计".PHP_EOL; + echo "--收入类型统计中".PHP_EOL; $this->setIncomeMoney(); - //按合作方类型 + + echo "--合作方类型统计中".PHP_EOL; $this->setPromoteMoney(); - //支付渠道/支付类型 - $this->setPayWayMoney(); - //按支付商户 + // + echo "--支付渠道统计中".PHP_EOL; + $this->setChannelMoney(); + + echo "--支付类型统计中".PHP_EOL; + $this->setPaywayMoney(); + + echo "--支付商户统计中".PHP_EOL; $this->setMerchantMoney(); - //存入数据 + + echo "--数据保存".PHP_EOL; $this->addDb(); $t2 = microtime(true); @@ -210,7 +219,7 @@ class FinancialSummarySetController extends \Think\Controller $map2 = array( "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)) ); - $test_pay_amount = M("TestOrder")->where($map2)->field("IFNULL(sum(pay_amount),0) pay_amount")->find()['pay_amount']; + $test_pay_amount = $this->TestOrderModel->where($map2)->field("IFNULL(sum(pay_amount),0) pay_amount")->find()['pay_amount']; $temparr['sum_money'] = number_format(($cash_spend*100 + $deposit*100 + $test_pay_amount*100 )/100, 2, '.', ''); @@ -402,8 +411,20 @@ class FinancialSummarySetController extends \Think\Controller ->group("p.channel") ->where($co_map) ->select(); - - $dbres = array_merge($spres,$ssres,$dpres,$cores); + + //测试的订单 + $to_map =[ + "s.pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "s.merchant_id"=>["GT","0"] + ]; + $tores=$this->TestOrderModel + ->alias("s") + ->field("SUM(s.pay_amount) pay_amount,p.channel") + ->join("left join tab_payment_merchant p ON p.id = s.merchant_id") + ->group("p.channel") + ->where($to_map) + ->select(); + $dbres = array_merge($spres,$ssres,$dpres,$cores,$tores); foreach ($dbres as $k=>$v){ $Channel[$v['channel']] = $Channel[$v['channel']]-0; $Channel[$v['channel']] += $v['pay_amount']; @@ -474,8 +495,20 @@ class FinancialSummarySetController extends \Think\Controller ->group("s.merchant_way") ->where($co_map) ->select(); + + //测试的订单 + $to_map =[ + "s.pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), + "s.merchant_id"=>["GT","0"] + ]; + $tores=$this->TestOrderModel + ->alias("s") + ->field("SUM(s.pay_amount) pay_amount,s.merchant_way") + ->group("s.merchant_way") + ->where($to_map) + ->select(); - $dbres = array_merge($spres,$ssres,$dpres,$cores); + $dbres = array_merge($spres,$ssres,$dpres,$cores,$tores); foreach ($dbres as $k=>$v){ $Ways[$v['merchant_way']] = $Ways[$v['merchant_way']]-0; $Ways[$v['merchant_way']] += $v['pay_amount'];