moonsflyer hace 9 meses
padre
commit
b4f2f3da55
Se han modificado 1 ficheros con 15 adiciones y 4 borrados
  1. 15 4
      app/adminapi/logic/WorkbenchLogic.php

+ 15 - 4
app/adminapi/logic/WorkbenchLogic.php

@@ -181,8 +181,10 @@ class WorkbenchLogic extends BaseLogic
         }
         array_multisort( $search_date); // 先按年龄排序,再按名字排
         foreach($search_date as $k=>$v){
-            $where['lease_status'] = 3;
-            $where['lease_expiration_time'] =$v;
+            $where = [];
+            $where[] = ['lease_status','=',3];
+            $where[] = ['lease_expiration_time','<',$v];
+
             $asset_number = AssetInfo::where($where)->count();
             $num[$k] = $asset_number;
         }
@@ -204,12 +206,21 @@ class WorkbenchLogic extends BaseLogic
     {
         $num = [];
         $date = [];
+        $j=7;
         for ($i = 0; $i < 7; $i++) {
             $where_start = strtotime("- " . $i . "day");
             $date[] = date('m/d', $where_start);
-            $num[$i] = rand(30, 200);
+            $search_date[$j] = date('Y-m-d', $where_start);
+            $j--;
+        }
+        array_multisort( $search_date); // 先按年龄排序,再按名字排
+        foreach($search_date as $k=>$v){
+            $where = [];
+            $where[] = ['lease_status','=',2];
+            $where[] = ['lease_expiration_time','<',$v];
+            $asset_number = AssetInfo::where($where)->count();
+            $num[$k] = $asset_number;
         }
-
         return [
             'date' => $date,
             'list' => [