From ae41da1a8e6283a1bdb816a257d5de8d1c53ecb2 Mon Sep 17 00:00:00 2001 From: lccsw <1127794702@qq.com> Date: Fri, 17 Sep 2021 17:02:23 +0800 Subject: [PATCH] edit-licheb-statics --- api/controllers/wxapp/licheb/Statistics.php | 36 +++++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/api/controllers/wxapp/licheb/Statistics.php b/api/controllers/wxapp/licheb/Statistics.php index e70c5818..14266437 100644 --- a/api/controllers/wxapp/licheb/Statistics.php +++ b/api/controllers/wxapp/licheb/Statistics.php @@ -24,19 +24,27 @@ class Statistics extends Wxapp{ //统计客户 protected function get_cust(){ $season = $this->input_param('season'); - !strlen($season) && $season = ceil((date('n'))/3)-1;//当月是第几季度 - $season_data = $this->season_data($season+1); - $days = getMonth($season+1); + //!strlen($season) && $season = ceil((date('n'))/3)-1;//当月是第几季度 + //$season_data = $this->season_data($season+1); + //$days = getMonth($season+1); + !strlen($season) && $season = date('n')-1;//当前月份 + $month = $season+1; + $season_data = $this->months(); $series = []; $bizs = []; $months_arr = []; - foreach($days as $val){ - $months_arr[] = [ - 'cn' => date('n月',strtotime($val)), - 's_time' => date('Y-m-01 00:00:00',strtotime($val)), - 'e_time' => date('Y-m-t 23:59:59',strtotime($val)), - ]; - } + //foreach($days as $val){ + // $months_arr[] = [ + // 'cn' => date('n月',strtotime($val)), + // 's_time' => date('Y-m-01 00:00:00',strtotime($val)), + // 'e_time' => date('Y-m-t 23:59:59',strtotime($val)), + // ]; + //} + $months_arr[] = [ + 'cn' => $season_data[$season], + 's_time' => date("Y-{$month}-01 00:00:00"), + 'e_time' => date("Y-{$month}-t 23:59:59"), + ]; $biz_id_arr = explode(',',$this->session['biz_id']); if($biz_id_arr){ $bizs_lists = $this->biz_model->get_by_id_arr($biz_id_arr,'id,biz_name',true); @@ -566,6 +574,14 @@ class Statistics extends Wxapp{ ]; return $data; } + + /** + * 获取月份 + */ + private function months(){ + $months = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']; + return $months; + } /** * 获取季度 * @param int $season 当前季度