tongshanglei 2 years ago
parent
commit
5b71ef3ee7
2 changed files with 21 additions and 13 deletions
  1. 16 6
      catch/device/controller/Station.php
  2. 5 7
      catch/map/controller/RouteMap.php

+ 16 - 6
catch/device/controller/Station.php

@@ -15,7 +15,7 @@ use PhpOffice\PhpSpreadsheet\IOFactory;
 use think\facade\Env;
 use think\facade\Db;
 use PDO;
-
+use think\facade\Cache;
 class Station extends CatchController
 {
     // protected $stationModel;
@@ -80,11 +80,20 @@ class Station extends CatchController
      */
     public function getAllList(Request $request) 
     {
+        $list=Cache::get('stationList'); 
+        if($list){
+            return [
+                'code'=>10000,
+                'message'=>'查询成功',
+                'data'=>$list,
+            ];
+
+        }
         $cond=[
             '_string'=>'a.DEVICE_CODE = r.DEVICE_CODE',
         ];
         $cond['page']=1;
-        $cond['limit']=3000;
+        $cond['limit']=30000;
         $conn = null;
         $tableName='(SELECT * FROM DSSC2.ADM_DEV  ORDER BY ID DESC) a,DSSC2.ADM_DEV_RFID_CHN r';
         $field='a.ID,a.IS_ONLINE,a.LOGIN_NAME,a.DEVICE_CODE,a.DEVICE_NAME,a.OWNER_CODE,to_char(a.UPDATE_DATE,\'yyyy-mm-dd hh24:mi:ss\') UPDATE_DATE,r.GPS_X,r.GPS_Y';
@@ -112,16 +121,17 @@ class Station extends CatchController
         $rows=[];
         while($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
             if($row['GPS_Y'] && $row['GPS_X']){
-                $wgsLoc = \algorithm\Geometry::wgsTOgcj((float)$row['GPS_Y'],(float)$row['GPS_X']);
-                $lngLat = \algorithm\Geometry::convertGcj02ToBd09($wgsLoc['lat'],$wgsLoc['lng']);
-                $row['GPS_X']=$lngLat['lng'];
-                $row['GPS_Y']=$lngLat['lat'];
+                // $wgsLoc = \algorithm\Geometry::wgsTOgcj((float)$row['GPS_Y'],(float)$row['GPS_X']);
+                // $lngLat = \algorithm\Geometry::convertGcj02ToBd09($wgsLoc['lat'],$wgsLoc['lng']);
+                // $row['GPS_X']=$lngLat['lng'];
+                // $row['GPS_Y']=$lngLat['lat'];
                 $rows[]=$row;
             }
             
             
         }
         oci_free_statement($stid);
+        Cache::set('stationList', $rows, 300);
         $response=[
             'code'=>10000,
             'message'=>'查询成功',

+ 5 - 7
catch/map/controller/RouteMap.php

@@ -544,7 +544,7 @@ class RouteMap extends CatchController
       
         $params=$request->param();
 
-        $device_number = $params['device_number'];
+        $device_number = trim($params['device_number']);
        
         if (!$device_number) {
             return CatchResponse::fail("获取设备号失败");
@@ -578,12 +578,10 @@ class RouteMap extends CatchController
         // var_dump($r);
         $rows=[];
         while($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
-                 // $val['DEVICE_NAME'] = mb_convert_encoding($val['DEVICE_NAME'], 'UTF-8', 'GBK');
-            // $val['RF_DATE'] = mb_convert_encoding($val['RF_DATE'], 'UTF-8', 'GBK');
-            $wgsLoc = \algorithm\Geometry::wgsTOgcj($row['GPS_Y'],$row['GPS_X']);
-            $lngLat = \algorithm\Geometry::convertGcj02ToBd09($wgsLoc['lat'],$wgsLoc['lng']);
-            $row['GPS_X']=$lngLat['lng'];
-            $row['GPS_Y']=$lngLat['lat'];
+            // $wgsLoc = \algorithm\Geometry::wgsTOgcj($row['GPS_Y'],$row['GPS_X']);
+            // $lngLat = \algorithm\Geometry::convertGcj02ToBd09($wgsLoc['lat'],$wgsLoc['lng']);
+            // $row['GPS_X']=$lngLat['lng'];
+            // $row['GPS_Y']=$lngLat['lat'];
             $rows[]=$row;
         }
         // var_dump($rows);