moonsflyer 8 months ago
parent
commit
bd734c5efd
1 changed files with 10 additions and 6 deletions
  1. 10 6
      app/adminapi/logic/WorkbenchLogic.php

+ 10 - 6
app/adminapi/logic/WorkbenchLogic.php

@@ -311,28 +311,32 @@ class WorkbenchLogic extends BaseLogic
     }
 
     public static function production($area_id,$start_time,$end_time){
+
+        $where = [];
+        $where[]=['sdi.type','=',1];
+        $where[]=['sdi.status','=',2];
+
         if($area_id){
 
         }
 
         if($start_time <> '' && $end_time <> ''){
-
+            $where[]=['create_time','between',[]];
+            $where[] = ['create_time', 'between', [strtotime($start_time),strtotime($end_time. ' 23:59:59')]];
         }else{
             if($start_time<>''){
-
+                $where[]=['create_time','>=',strtotime($start_time)];
             }
 
             if($end_time <> ''){
-
+                $where[]=['create_time','<=',strtotime($end_time. ' 23:59:59')]];
             }
         }
-        $where = [];
-        $where[]=['sdi.type','=',1];
-        $where[]=['sdi.status','=',2];
 
         $supply_demand_list = SupplyDemandInfo::alias('sdi')
                             ->leftJoin('supply_demand_cate sdc','sdc.id = sdi.cate_id')
                             ->field('sdi.cate_id,sdc.name,sum(sdi.number) total_num')
+
                             ->where($where)->group('sdi.cate_id')->select()->toArray();
         $name = [];
         $value = [] ;