cqp пре 1 месец
родитељ
комит
a4dbb02bf0
2 измењених фајлова са 15 додато и 6 уклоњено
  1. 8 6
      app/Model/ItemNode.php
  2. 7 0
      app/Service/StatisticService.php

+ 8 - 6
app/Model/ItemNode.php

@@ -17,15 +17,17 @@ class ItemNode extends DataScopeBaseModel
 
     public static $field = ['*'];
 
-    const TYPE_ZERO = 0;
+    const TYPE_MINUS_TWO = -2;
+    const TYPE_MINUS_ONE = -1;
     const TYPE_ONE = 1;
     const TYPE_TWO = 2;
-    const TYPE_MINUS = -1;
+    const TYPE_THREE = 3;
     const State_Type = [
-        self::TYPE_MINUS => '审核驳回',
-        self::TYPE_ZERO => '未审核',
-        self::TYPE_ONE => '待审核',
-        self::TYPE_TWO => '审核通过',
+        self::TYPE_MINUS_ONE => '审核中',
+        self::TYPE_MINUS_TWO => '已超期',
+        self::TYPE_ONE => '待开始',
+        self::TYPE_TWO => '进行中',
+        self::TYPE_THREE => '已完成',
     ];
 
     const delivery_zero = 0;

+ 7 - 0
app/Service/StatisticService.php

@@ -968,6 +968,13 @@ class StatisticService extends StatisticCommonService
         if(! empty($data['title'])) $model->where('title', 'LIKE', '%'.$data['title'].'%');
         if(! empty($data['code'])) $model->where('code', 'LIKE', '%'.$data['code'].'%');
         if(! empty($data['state'])) $model->where('state', $data['state']);
+        if(! empty($data['year'])) {
+            $return = $this->getYearRangeInfo($data['year']);
+            if (is_null($return)) return [false, '年度格式错误'];
+            list($month_start, $month_end) = $return;
+            $model->where("start_time", ">=", $month_start)
+                ->where("end_time", "<", $month_end);
+        }
 
         $list = $model->get()->toArray();
         if(empty($list)) return [true,[]];