tongshanglei %!s(int64=2) %!d(string=hai) anos
pai
achega
a5360b20cc
Modificáronse 2 ficheiros con 37 adicións e 8 borrados
  1. 6 0
      catch/device/model/get/StationGet.php
  2. 31 8
      catch/map/controller/RouteMap.php

+ 6 - 0
catch/device/model/get/StationGet.php

@@ -29,6 +29,12 @@ trait StationGet
             return '1';
         }
     }
+    public function getOnlineTimeAttr($value){
+        if($value){
+            return $value;
+        }
+        return '-';
+    }
     public function getIsOnlineTextAttr($value){
         $value = strtotime($this->online_time);
         $int=time()-$value;

+ 31 - 8
catch/map/controller/RouteMap.php

@@ -622,18 +622,41 @@ class RouteMap extends CatchController
     {
       
         $params=$request->param();
-        
+        if($params['route_type']!='1'){
+            $response=[
+                'code'=>10000,
+                'message'=>'查询成功',
+                'count'=>0,
+                'data'=>[],
+                'current'=>isset($params['page'])?(int)$params['page']:1,
+                'limit'=>isset($params['limit'])?(int)$params['limit']:10,
+            ];
+            return $response; 
+        }
         $cond=[];
         // $cond=[
         //     '_string'=>'a.RF_FLAGID = s.RFID_SN AND o.rfid_id = s.id',
         // ];
         
-        // if($params['device_number']){
-        //     $cond['RF_FLAGID']=['=',$params['device_number']];
-        // }
+        if($params['name']){
+            $mac=Db::table('stations')->whereLike('name',$params['name'])->value('mac');
+            $cond['RF_ID']=['=',$mac];
+        }
+        if($params['rfid_sn']){
+            $cond['RF_FLAGID']=['=',$params['rfid_sn']];
+        }
+        $conn=getOracleConnect();
+        if($params['plate_no']){
+            $rfid_sn='';
+            $vehicle_sql='SELECT s.RFID_SN FROM DSSC3.W_DW_NON_MOTOR o,DSSC3.W_DW_RFID_TAGS s WHERE o.PLATE_NO =\''.$params['plate_no'].'\'  AND o.rfid_id = s.id  ';
+            $vtid = oci_parse($conn, $vehicle_sql);
+            oci_define_by_name($vtid, 'RFID_SN', $rfid_sn);
+            oci_execute($vtid);
+            oci_fetch($vtid);
+            $cond['RF_FLAGID']=['=',$rfid_sn];
+        }
         $start_time = date('Y-m-d 00:00:00',time());
         $end_time = date('Y-m-d 23:59:59',time());
-
         if(isset($params['timeRange']) && $params['timeRange'] != ''){
             $start_time=date('Y-m-d H:i:s',strtotime($params['timeRange'][0]));
             $end_time=date('Y-m-d H:i:s',strtotime($params['timeRange'][1]));
@@ -641,11 +664,11 @@ class RouteMap extends CatchController
         }
         // $count=queryOracleCount('DSSC2.W_DW_RF_RECORD a',$cond);
         
-        $cond['page']=isset($param['page'])?$param['page']:1;
-        $cond['limit']=isset($param['limit'])?$param['limit']:10;
+        $cond['page']=isset($params['page'])?$params['page']:1;
+        $cond['limit']=isset($params['limit'])?$params['limit']:10;
         $rows=[];
         $rows=queryOracleSelect('(SELECT * FROM DSSC2.W_DW_RF_RECORD  ORDER BY ID DESC) a',$cond,'a.RF_FLAGID,a.RF_STAT,a.RF_ID,to_char(a.RF_DATE,\'yyyy-mm-dd hh24:mi:ss\') RF_DATE');
-        $conn=getOracleConnect();
+        
         foreach($rows as &$val){
             $vehicle_sql='SELECT o.PLATE_NO FROM DSSC3.W_DW_NON_MOTOR o,DSSC3.W_DW_RFID_TAGS s WHERE s.RFID_SN =\''.$val['RF_FLAGID'].'\'  AND o.rfid_id = s.id  ';
             $plate_no='';