tongshanglei il y a 2 ans
Parent
commit
b3f7b38446
2 fichiers modifiés avec 42 ajouts et 1 suppressions
  1. 10 0
      catch/device/controller/Station.php
  2. 32 1
      catch/yunying/controller/Vehicle.php

+ 10 - 0
catch/device/controller/Station.php

@@ -46,6 +46,8 @@ class Station extends CatchController
         $gcjLoc = \algorithm\Geometry::wgsTOgcj((float)$params['latitude'],(float)$params['longitude']);
         $params['longitude']=$gcjLoc['lng'];
         $params['latitude']=$gcjLoc['lat'];
+        $params['DATA_TYPE']='station_save';
+        pushDataToRedisList($params);
         return CatchResponse::success($this->stationModel->storeBy($params));
     }
     
@@ -72,6 +74,9 @@ class Station extends CatchController
         $gcjLoc = \algorithm\Geometry::wgsTOgcj((float)$params['latitude'],(float)$params['longitude']);
         $params['longitude']=$gcjLoc['lng'];
         $params['latitude']=$gcjLoc['lat'];
+        $params['update_id']=$id;
+        $params['DATA_TYPE']='station_update';
+        pushDataToRedisList($params);
         return CatchResponse::success($this->stationModel->updateBy($id, $params));
     }
     
@@ -82,6 +87,9 @@ class Station extends CatchController
      */
     public function delete($id) : \think\Response
     {
+        $params['delete_id']=$id;
+        $params['DATA_TYPE']='station_save';
+        pushDataToRedisList($params);
         return CatchResponse::success($this->stationModel->deleteBy($id,true));
     }
 
@@ -201,6 +209,8 @@ class Station extends CatchController
                 $arr['name'] = trim($sheet->getCell("D" . $j)->getFormattedValue());  
                 $arr['created_at']=time();
                 $arr['shortcode']=$shortcode;
+                $arr['DATA_TYPE']='station_save';
+                pushDataToRedisList($arr);
                 array_push($data,$arr);
                
             }

+ 32 - 1
catch/yunying/controller/Vehicle.php

@@ -209,6 +209,8 @@ class Vehicle extends CatchController
         $param['INSTA_DATE']=date('Y-m-d H:i:s',time());
         $param['INSTALLER']=$installer;
         $r=$this->execSaveVehicle($param);
+        $param['DATA_TYPE']='vehicle_save';
+        pushDataToRedisList($param);
         return CatchResponse::success($r);
     }
     private function execSaveVehicle($data){
@@ -237,10 +239,20 @@ class Vehicle extends CatchController
     public function update(Request $request, $id) : \think\Response
     {
         $params=$request->post();
+        $conn=getOracleConnect();
+        //查老的车牌
+        $vehicle_sql='SELECT o.PLATE_NO FROM DSSC3.W_DW_NON_MOTOR o WHERE o.RFID_ID =\''.$id.'\' ';
+        $OLD_NO='';
+        $stid = oci_parse($conn, $vehicle_sql);
+        oci_define_by_name($stid, 'PLATE_NO', $OLD_NO);
+        oci_execute($stid);
+        oci_fetch($stid);
+        $params['OLD_NO']=$OLD_NO;
+
         $params['RFID_SN']=strtoupper($params['RFID_SN']);
         $params['PLATE_NO']=strtoupper($params['PLATE_NO']);
         // var_dump($params);
-        $conn=getOracleConnect();
+       
         // //更新
         $sql='UPDATE DSSC3.W_DW_RFID_TAGS  SET RFID_SN = \''.$params['RFID_SN'].'\' WHERE ID = \''.$id.'\' ';
         $stid = oci_parse($conn, $sql);
@@ -251,6 +263,9 @@ class Vehicle extends CatchController
         $stid2 = oci_parse($conn, $sql);
         $r2 = oci_execute($stid2);
         
+        $params['DATA_TYPE']='vehicle_update';
+        pushDataToRedisList($params);
+
         return CatchResponse::success('修改成功');
 
     }
@@ -263,6 +278,18 @@ class Vehicle extends CatchController
     public function delete($id) : \think\Response
     {
         $conn=getOracleConnect();
+
+        $sql='SELECT PLATE_NO FROM DSSC3.W_DW_NON_MOTOR  WHERE RFID_ID in ('.$id.')';
+        $stid = oci_parse($conn, $sql);
+        $r = oci_execute($stid);
+        $rows=[];
+        while($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
+            $rows[]=$row['PLATE_NO'];
+        }
+        $delete_data['PLATE_NO']=$rows;
+        $delete_data['DATA_TYPE']='vehicle_delete';
+
+
         $sql='DELETE FROM DSSC3.W_DW_RFID_TAGS WHERE ID in ('.$id.')';
       
         $stid = oci_parse($conn, $sql);
@@ -271,6 +298,8 @@ class Vehicle extends CatchController
         $sql='DELETE FROM DSSC3.W_DW_NON_MOTOR WHERE RFID_ID in ('.$id.')';
         $stid = oci_parse($conn, $sql);
         $r = oci_execute($stid);
+
+        pushDataToRedisList($delete_data);
         return CatchResponse::success($r);
     }
     /**
@@ -351,6 +380,8 @@ class Vehicle extends CatchController
                 // var_dump($arr);
                 $r=$this->execSaveVehicle($arr);
                 if($r){
+                    $arr['DATA_TYPE']='vehicle_save';
+                    pushDataToRedisList($arr);
                     $success++;
                 }else{
                     $fail++;