nana_sen 1 vuosi sitten
vanhempi
commit
0806d5421f
1 muutettua tiedostoa jossa 67 lisäystä ja 62 poistoa
  1. 67 62
      catch/api/controller/Api.php

+ 67 - 62
catch/api/controller/Api.php

@@ -123,8 +123,8 @@ class Api extends CatchController
                      $rssiIn = 72;
 
                     //安装调测代码
-                    $de_macs = ['638006','638007'];
-                    $de_rfids = ['E2B6A925'];
+                    $de_macs = ['638006','638007', '631176'];
+                    $de_rfids = ['E2B6A925', '0200C1D2', '0200C1D1'];
                     if (in_array($mac, $de_macs) && in_array($label, $de_rfids)){
                         $deDa = $DA;
                         $deDa['time'] = date("Y-m-d H:i:s",$time);
@@ -775,7 +775,7 @@ class Api extends CatchController
                         $info = [
                             "mac" => $mac,
                             "id" => $rfid,
-                            "firs_time" => $time,
+                            "first_time" => $time,
                             "time" => $time,
                             "status" => 2,//2出状态,1进状态
                             "rssi" => [
@@ -1102,7 +1102,6 @@ class Api extends CatchController
             // debug_log("push_indoor_res","出推送依赖:".json_encode($info));
             // $url_res= curl_http_post(json_encode($url_data),$url,false);
             $info['pushTime'] = time();
-            
             // debug_log("push_indoor_res","远程返回结果".$url_res);
         }
         return $info;
@@ -1119,7 +1118,8 @@ class Api extends CatchController
         $flagOut = $avg["front"] > $config["front_out"] && $avg["behind"] > $config["behind_out"] && $avg["left"] > $config["left_out"] && $avg["right"] > $config["right_out"];
 
 
-        if($flagIn && ($status == 2 || $status == 3) ){
+        if($flagIn){
+        // if($flagIn && ($status == 2 || $status == 3) ){
         // if($flagIn){
             $inoutIntFilter = $ues_redis->hget("anbang_four_wire", "anbang_4rssi_intFilter");
             $inoutIntFilter = $inoutIntFilter ? $inoutIntFilter : 20;
@@ -1130,42 +1130,47 @@ class Api extends CatchController
             //推送进
             $info['status'] = 1;
 
-            // 临时功能代码
-            var_dump($info["id"]);
-            $labels = ['0200C1D1', '0200C1D2']; //测试设备
-            if (in_array(strtoupper($info['id']), $labels)) {
-                # code...
-                //card_black
-                $where = [];
-                $where[] = ['type', '=','basic_config'];
-                $where[] = ['field', '=','card_black'];
-                $bkList = Db::name('sys_config')->where($where)->find();
-                $bkList = explode(',', $bkList['fieldValue']);
-                // var_dump($info['id'],in_array(strtoupper($info['id']), $bkList),$bkList);
-                if (in_array(strtoupper($info['id']), $bkList)) {
-                    # code...
-                    $info['status'] = 3;
-                }
+            // // 临时功能代码
+            // var_dump($info["id"]);
+            // $labels = ['0200C1D1', '0200C1D2']; //测试设备
+            // if (in_array(strtoupper($info['id']), $labels)) {
+            //     # code...
+            //     //card_black
+            //     $where = [];
+            //     $where[] = ['type', '=','basic_config'];
+            //     $where[] = ['field', '=','card_black'];
+            //     $bkList = Db::name('sys_config')->where($where)->find();
+            //     $bkList = explode(',', $bkList['fieldValue']);
+            //     // var_dump($info['id'],in_array(strtoupper($info['id']), $bkList),$bkList);
+            //     if (in_array(strtoupper($info['id']), $bkList)) {
+            //         # code...
+            //         $info['status'] = 3;
+            //     }
                 
-            }
+            // }
+            $expInt =$info["time"]-$info["first_time"];
             
-            $url_data = [
-                "mac" => $info["mac"],
-                "data" => [
-                    [
-                        "label" => $info["id"],
-                        "time" => $info["time"],
-                        "first_time" => $info["first_time"],
-                        "dirt" => $info['status'],
-                        "rssi" => $info["rssi"],//数组 [{"front":72,"behind":255,"left":255,"right":255,"time":1685067709},{"front":76,"behind":255,"left":255,"right":255,"time":1685067710}]
-                        "avg" => $info["avg"] //{"front":"77.17","behind":"90.00","left":"90.00","right":"90.00"}
+            if ($expInt >= 120 && !key_exists('pushTime', $info)) {
+                # code...
+                // var_dump('-------------expint------',$info["id"],$expInt);
+                $url_data = [
+                    "mac" => $info["mac"],
+                    "data" => [
+                        [
+                            "label" => $info["id"],
+                            "time" => $info["time"],
+                            "first_time" => $info["first_time"],
+                            "dirt" => $info['status'],
+                            "rssi" => $info["rssi"],//数组 [{"front":72,"behind":255,"left":255,"right":255,"time":1685067709},{"front":76,"behind":255,"left":255,"right":255,"time":1685067710}]
+                            "avg" => $info["avg"] //{"front":"77.17","behind":"90.00","left":"90.00","right":"90.00"}
+                        ]
                     ]
-                ]
-            ];
-            // debug_log("pushPareaRes","进推送依赖:".json_encode($info));
-            // $url_res= curl_http_post(json_encode($url_data),$url,false);
-            $ues_redis->lpush("parea_inoutres_push", json_encode($url_data));
-            $info['pushTime'] = time();
+                ];
+                // debug_log("pushPareaRes","进推送依赖:".json_encode($info));
+                $ues_redis->lpush("parea_inoutres_push", json_encode($url_data));
+                $info['pushTime'] = time();
+            }
+
             // debug_log("pushPareaRes","远程返回结果".$url_res);
         }
         // if($info['id'] == "E2B15AD5"){
@@ -1197,30 +1202,30 @@ class Api extends CatchController
             
             // debug_log("pushPareaRes","远程返回结果".$url_res);
         }
-        if($flagIn && $info['status'] == 1){
-            $inoutIntFilter = $ues_redis->hget("anbang_four_wire", "anbang_4rssi_intFilter");
-            $inoutIntFilter = $inoutIntFilter ? $inoutIntFilter : 20;
-            if ($info["camPushTime"] &&  (time()-$info['camPushTime']) < $inoutIntFilter ) { 
-                # code...
-                return $info;
-            }
-            //推送进
-            $url_data = [
-                "mac" => $info["mac"],
-                "first_time" => $info["first_time"],
-                "data" => [
-                    [
-                        "label" => $info["id"],
-                        "time" => $info["time"],
-                        "dirt" => 1,
-                        "rssi" => $info["rssi"],//数组 [{"front":72,"behind":255,"left":255,"right":255,"time":1685067709},{"front":76,"behind":255,"left":255,"right":255,"time":1685067710}]
-                        "avg" => $info["avg"] //{"front":"77.17","behind":"90.00","left":"90.00","right":"90.00"}
-                    ]
-                ]
-            ];
-            $ues_redis->lpush("parea_inoutres_push", json_encode($url_data));
-            $info["camPushTime"] = time();
-        }
+        // if($flagIn && $info['status'] == 1){
+        //     $inoutIntFilter = $ues_redis->hget("anbang_four_wire", "anbang_4rssi_intFilter");
+        //     $inoutIntFilter = $inoutIntFilter ? $inoutIntFilter : 20;
+        //     if ($info["camPushTime"] &&  (time()-$info['camPushTime']) < $inoutIntFilter ) { 
+        //         # code...
+        //         return $info;
+        //     }
+        //     //推送进
+        //     $url_data = [
+        //         "mac" => $info["mac"],
+        //         "first_time" => $info["first_time"],
+        //         "data" => [
+        //             [
+        //                 "label" => $info["id"],
+        //                 "time" => $info["time"],
+        //                 "dirt" => 1,
+        //                 "rssi" => $info["rssi"],//数组 [{"front":72,"behind":255,"left":255,"right":255,"time":1685067709},{"front":76,"behind":255,"left":255,"right":255,"time":1685067710}]
+        //                 "avg" => $info["avg"] //{"front":"77.17","behind":"90.00","left":"90.00","right":"90.00"}
+        //             ]
+        //         ]
+        //     ];
+        //     $ues_redis->lpush("parea_inoutres_push", json_encode($url_data));
+        //     $info["camPushTime"] = time();
+        // }
 
         return $info;
     }