Browse Source

Merge branch 'master' of http://gogs.renlianiot.com:4000/zmcoding/smart-tool-api

likang 2 years ago
parent
commit
10c43d60e3
2 changed files with 41 additions and 27 deletions
  1. 28 26
      catch/report/controller/Report.php
  2. 13 1
      catch/screen/controller/Preview.php

+ 28 - 26
catch/report/controller/Report.php

@@ -62,40 +62,42 @@ class Report extends CatchController
     public function hydraulicCount(Request $request)
     {
         $list =array(
-            ['type'=>'液压泵','name'=>'在线','value'=>103],
-            ['type'=>'液压泵','name'=>'离线','value'=>17],
-            ['type'=>'液压泵','name'=>'其他','value'=>28],
-            ['type'=>'液压泵','name'=>'总数','value'=>148],
-
-            ['type'=>'液压扳手','name'=>'合格','value'=>140],
-            ['type'=>'液压扳手','name'=>'不合格','value'=>24],
-            ['type'=>'液压扳手','name'=>'总数','value'=>164],
-        );
-        $pump_bar=array(
-            'xData'=>['总数','B1','B2','B3','B4','B5',],
-            'yData'=>[250,100,20,30,60,40],
+            ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>5,'remarks'=>''],
+            ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>3,'remarks'=>''],
+            ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>2,'remarks'=>''],
+            ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>4,'remarks'=>''],
+            ['type'=>'液压泵','name'=>'测试设备1','number'=>20210618,'online_time'=>'2022-06-23 11:10:11','address'=>'杭州滨江','unused_days'=>1,'remarks'=>''],
+          
         );
-        $pump_pie=array(
-            ['name'=>'在线','value'=>113],
-            ['name'=>'离线','value'=>17],
-            ['name'=>'其他','value'=>18],
+
+        $list20 =array(
+            ['type'=>'液压泵','name'=>'测试设备2','number'=>20210618,'online_time'=>'2022-06-03 11:10:11','address'=>'杭州滨江','unused_days'=>20,'remarks'=>''],
+            ['type'=>'液压泵','name'=>'测试设备2','number'=>20210618,'online_time'=>'2022-06-03 11:10:11','address'=>'杭州滨江','unused_days'=>22,'remarks'=>''],
+            ['type'=>'液压泵','name'=>'测试设备2','number'=>20210618,'online_time'=>'2022-06-03 11:10:11','address'=>'杭州滨江','unused_days'=>22,'remarks'=>''],
+            ['type'=>'液压泵','name'=>'测试设备2','number'=>20210618,'online_time'=>'2022-06-03 11:10:11','address'=>'杭州滨江','unused_days'=>22,'remarks'=>''],
+            ['type'=>'液压泵','name'=>'测试设备2','number'=>20210618,'online_time'=>'2022-06-03 11:10:11','address'=>'杭州滨江','unused_days'=>22,'remarks'=>''],
         );
-        $wrench_bar=array(
-            'xData'=>['总数','A1','A2','A3','A4','A5',],
-            'yData'=>[230,103,17,50,35,25],
+
+        $list40 =array(
+            ['type'=>'液压泵','name'=>'测试设备3','number'=>20210618,'online_time'=>'2022-06-13 11:10:11','address'=>'杭州滨江','unused_days'=>41,'remarks'=>''],
+            ['type'=>'液压泵','name'=>'测试设备3','number'=>20210618,'online_time'=>'2022-06-13 11:10:11','address'=>'杭州滨江','unused_days'=>41,'remarks'=>''],
+            ['type'=>'液压泵','name'=>'测试设备3','number'=>20210618,'online_time'=>'2022-06-13 11:10:11','address'=>'杭州滨江','unused_days'=>41,'remarks'=>''],
+            ['type'=>'液压泵','name'=>'测试设备3','number'=>20210618,'online_time'=>'2022-06-13 11:10:11','address'=>'杭州滨江','unused_days'=>41,'remarks'=>''],
+            ['type'=>'液压泵','name'=>'测试设备3','number'=>20210618,'online_time'=>'2022-06-13 11:10:11','address'=>'杭州滨江','unused_days'=>41,'remarks'=>''],
         );
-        $wrench_pie=array(
-            ['name'=>'合格','value'=>103],
-            ['name'=>'不合格','value'=>17],
 
+        $pie_data=array(
+            ['name'=>'正常使用','value'=>113],
+            ['name'=>'20+天未使用','value'=>17],
+            ['name'=>'40+天未使用','value'=>18],
         );
+       
 
         $data=array(
             'list'=>$list,
-            'pump_bar'=>$pump_bar,
-            'pump_pie'=>$pump_pie,
-            'wrench_bar'=>$wrench_bar,
-            'wrench_pie'=>$wrench_pie,
+            'list20'=>$list20,
+            'list40'=>$list40,
+            'pie_data'=>$pie_data,
         );
         return CatchResponse::success($data);
     }

+ 13 - 1
catch/screen/controller/Preview.php

@@ -46,7 +46,8 @@ class Preview extends CatchController
         // $deviceList=$this->deviceModel->dataRange()->limit($start,$limit)->cache(60)->column('id,point_x,point_y,addr,well_type');
         // var_dump($deviceList);
         $addrList=array();
-        for($i=0;$i<50;$i++){
+        $addrList1=array();
+        for($i=0;$i<20;$i++){
             $a=mt_rand();
             $b=mt_getrandmax();
             $c=$a/$b;
@@ -56,12 +57,23 @@ class Preview extends CatchController
             // var_dump($lat);
             $item=array('value'=>[$lng, $lat],'name'=>"测试风场".$i,'address'=>'风场位置'.$i,'number'=>mt_rand(0, 20));
             array_push($addrList,$item);
+            
+            $a=mt_rand();
+            $b=mt_getrandmax();
+            $c=$a/$b;
+            $lng=mt_rand(100, 118)+$c;
+            $lat=mt_rand(25, 35)+$c;
+            // var_dump($lng);
+            // var_dump($lat);
+            $item=array('value'=>[$lng, $lat],'name'=>"测试风场".$i,'address'=>'风场位置'.$i,'number'=>mt_rand(0, 20));
+            array_push($addrList1,$item);
         }
         // foreach($deviceList as $val){
         //     $item=array('value'=>[$val['point_y'], $val['point_x']],'name'=>$val['addr']);
         //     array_push($addrList,$item);
         // }
         $res['addrList']=$addrList;
+        $res['addrList1']=$addrList1;
         // $res['total']=$this->deviceModel->dataRange()->count();
         $res['total']=80;
         return CatchResponse::success($res);