From 9e171f2ce246e9846a9ed98fa06698f051cd2a91 Mon Sep 17 00:00:00 2001 From: chenzhi <“chenzhi063@qq.com> Date: Tue, 26 Nov 2019 15:28:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IndexChartSetController.class.php | 2 +- .../StatisticsCountSetController.class.php | 112 ++++++++++++++++++ 2 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 Application/Admin/Controller/StatisticsCountSetController.class.php diff --git a/Application/Admin/Controller/IndexChartSetController.class.php b/Application/Admin/Controller/IndexChartSetController.class.php index 624820404..a151c4ab2 100644 --- a/Application/Admin/Controller/IndexChartSetController.class.php +++ b/Application/Admin/Controller/IndexChartSetController.class.php @@ -98,7 +98,7 @@ class IndexChartSetController extends AdminController { $this->ChartModel->where("date = '{$this->beginTime}'")->delete(); $reset = "reset and creat "; }else{ - echo ("{$this->date} 已统计,请勿重复 ".PHP_EOL); + echo ("{$this->date} 已统计,请勿重复提交".PHP_EOL); return; } diff --git a/Application/Admin/Controller/StatisticsCountSetController.class.php b/Application/Admin/Controller/StatisticsCountSetController.class.php new file mode 100644 index 000000000..e1c57f331 --- /dev/null +++ b/Application/Admin/Controller/StatisticsCountSetController.class.php @@ -0,0 +1,112 @@ +UserModel =M("User","tab_"); + $this->ChartModel =M("IndexChart","tab_"); + $this->LoginModel =M("user_login_record","tab_"); + $this->SpendModel =M("spend","tab_"); + $this->PromoteModel =M("promote","tab_"); + $this->nowdata =time(); + if(I("reset")) $this->reset = true; + + } + public function setDateCount($date) + { + $this->date = $date; + $tarry = explode('-',$date); + $this->beginTime=mktime(0,0,0,$tarry[1],$tarry[2],$tarry[0]); + $this->endTime=mktime(0,0,0,$tarry[1],$tarry[2]-0+1,$tarry[0])-1; + + set_time_limit(0); + $t1 = microtime(true); + //判断是否存在 + // $res = $this->ChartModel->where("date = '{$this->beginTime}'")->find(); + // $reset=''; + // if(!empty($res)){ + // if($this->reset){ + // $this->ChartModel->where("date = '{$this->beginTime}'")->delete(); + // $reset = "reset and creat "; + // }else{ + // echo ("{$this->date} 已统计,请勿重复提交".PHP_EOL); + // return; + // } + + // } + + // $this->newUser(); + // $this->activeUser(); + // $this->payUser(); + // $this->payMoney(); + $this->promoteNew(); + // $this->allCount(); + // $this->createDb(); + echo "
"; + dump($this->addid); + dump($this->adddata); + $t2 = microtime(true); + echo ("{$this->date} {$reset}success runtime:".round($t2-$t1,3).'s'.PHP_EOL); + # code... + } + + //聚合推广员 + //1聚合新增 + public function promoteNew() + { + $map = ['register_time'=>['between',[$this->beginTime,$this->endTime]],"puid"=>0,"promote_id"=>["gt",0]];//0不是小号 + $promoteNew = $this->UserModel->field('COUNT(1) AS new_user_count,promote_id,promote_account') + ->where($map) + ->group("promote_id") + ->select(); + $count = count($promoteNew); + for ($i=0; $i < $count; $i++) { + $promoteNew[$i][''] + $this->addid[] = $promoteNew[$i]["promote_id"]; + $this->adddata[$promoteNew[$i]["promote_id"]] = $promoteNew[$i]; + } + } + //2聚合付费 + + public function promotePayMoeny() + { + $map = ['pay_time'=>['between',[$this->beginTime,$this->endTime]],"pay_status"=>1];//1支付成功 + $promotePayMoeny = $this->SpendModel->field('sum(pay_amount) AS pay_money_count,promote_id,promote_account') + ->where($map) + ->group("promote_id") + ->select(); + $count = count($promotePayMoeny); + for ($i=0; $i < $count; $i++) { + if (in_array($promotePayMoeny[$i]["promote_id"],$this->addid)) { + //存在 + + + } + $this->addid[] = $promoteNew[$i]["promote_id"]; + $this->adddata[$promoteNew[$i]["promote_id"]] = $promoteNew[$i]; + } + } + +}