lgy 1 周之前
父节点
当前提交
9cc3f11a0b
共有 1 个文件被更改,包括 6 次插入11 次删除
  1. 6 11
      jcjyhr/app/admin/servies/bi/BaseDataBiServies.php

+ 6 - 11
jcjyhr/app/admin/servies/bi/BaseDataBiServies.php

@@ -125,8 +125,8 @@ abstract class BaseDataBiServies
         ->field('count('.$this->countField.') AS count, date_format('.$this->timeFieldName.', "%Y%m") AS month')
         ->where($where)
         ->whereTime($this->timeFieldName, '>=', date('Y-m-01 00:00:00', strtotime('-5 months')))
-        ->group('month')
-        ->order('month', 'asc')
+        ->group(date_format($this->timeFieldName, "%Y%m"))
+        ->order(date_format($this->timeFieldName, "%Y%m"), 'asc')
         ->select()
         ->toArray();
         return $months;
@@ -151,22 +151,17 @@ abstract class BaseDataBiServies
         // 获取今天是本周第几日
         $w = date('w');
         $days = false;
-        var_dump(9);
         if($j > $w) {
             $days = $this->_getMonthDayData($where);
         } else {
             $days = $this->_getWeekDayData($where);
         }
-        var_dump(1);
         // 获取本月每日检查数量
         $months = $this->_fillMonthDayData($days);
-        var_dump(2);
         // 获取本周每日检查数量
         $weeks = $this->_fillWeekDayData($days);
-        var_dump(3);
         // 获取今日检查数量
         $day = $this->_fillDayCount($days);
-        var_dump(4);
         return [
             'months' => $months,
             'weeks' => $weeks,
@@ -243,8 +238,8 @@ abstract class BaseDataBiServies
         ->field('count('.$this->countField.') AS count, date_format('.$this->timeFieldName.', "%Y%m%d") AS day')
         ->where($where)
         ->whereMonth($this->timeFieldName)
-        ->group('date_format('.$this->timeFieldName.', "%Y%m%d") ')
-        ->order('date_format('.$this->timeFieldName.', "%Y%m%d") ', 'asc')
+        ->group(date_format($this->timeFieldName, "%Y%m%d"))
+        ->order(date_format($this->timeFieldName, "%Y%m%d"), 'asc')
         ->select()
         ->toArray();
         return $days;
@@ -283,8 +278,8 @@ abstract class BaseDataBiServies
         ->field('count('.$this->countField.') AS count, date_format('.$this->timeFieldName.', "%Y%m%d") AS day')
         ->where($where)
         ->whereWeek($this->timeFieldName)
-        ->group('day')
-        ->order('day', 'asc')
+        ->group(date_format($this->timeFieldName, "%Y%m%d"))
+        ->order(date_format($this->timeFieldName, "%Y%m%d"), 'asc')
         ->select()
         ->toArray();
         return $days;