likang 1 년 전
부모
커밋
0b321f0f9a
2개의 변경된 파일160개의 추가작업 그리고 61개의 파일을 삭제
  1. 60 21
      catch/api/controller/Api.php
  2. 100 40
      catch/api/service/dispose.php

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 60 - 21
catch/api/controller/Api.php


+ 100 - 40
catch/api/service/dispose.php

@@ -255,6 +255,9 @@ class dispose
                                 "mac"=>$data['mac'],
                                 "data"=>$data_array
                             ];
+                            //设定最后结果
+                            $this->set_time_results($data['mac'],$data['label'],$resArray['time']);
+                            //推送远程数据
                             $this->getRemoteData($url_data);
                             //清除缓存数据
                             $this->get_label_history(3,$data['mac'],$data['label']);
@@ -301,45 +304,45 @@ class dispose
 
 
     //排序
-    public function sortlist($list){
-        $list01=[];
-        $list02=[];
-        $list03=[];
-        $list04=[];
-        debug_log("InAndOUT","排序的数据:".json_encode($list));
-        foreach($list as $item){
-           array_push($list01,$item['rssi1']);
-           array_push($list02,$item['rssi2']);
-           array_push($list03,$item['rssi3']);
-           array_push($list04,$item['rssi4']);
-        }
+    // public function sortlist($list){
+    //     $list01=[];
+    //     $list02=[];
+    //     $list03=[];
+    //     $list04=[];
+    //     debug_log("InAndOUT","排序的数据:".json_encode($list));
+    //     foreach($list as $item){
+    //        array_push($list01,$item['rssi1']);
+    //        array_push($list02,$item['rssi2']);
+    //        array_push($list03,$item['rssi3']);
+    //        array_push($list04,$item['rssi4']);
+    //     }
 
-        if(count($list)>=3){
-            sort($list01);
-            sort($list02);
-            sort($list03);
-            sort($list04);
-            array_pop($list01);
-            array_pop($list02);
-            array_pop($list03);
-            array_pop($list04);
-            array_shift($list01);
-            array_shift($list02);
-            array_shift($list03);
-            array_shift($list04);
-        }
-        debug_log("InAndOUT","排序后的队列:".json_encode($list01));
-        debug_log("InAndOUT","排序后的队列:".json_encode($list02));
-        debug_log("InAndOUT","排序后的队列:".json_encode($list03));
-        debug_log("InAndOUT","排序后的队列:".json_encode($list04));
-        $rssi1= array_sum($list01)/count($list01);
-        $rssi2= array_sum($list02)/count($list02);
-        $rssi3= array_sum($list03)/count($list03);
-        $rssi4= array_sum($list04)/count($list04);
-        $res=[$rssi1,$rssi2,$rssi3,$rssi4];
-        debug_log("InAndOUT","结算后的结果:".json_encode($res));
-        return $res;
-    }
+    //     if(count($list)>=3){
+    //         sort($list01);
+    //         sort($list02);
+    //         sort($list03);
+    //         sort($list04);
+    //         array_pop($list01);
+    //         array_pop($list02);
+    //         array_pop($list03);
+    //         array_pop($list04);
+    //         array_shift($list01);
+    //         array_shift($list02);
+    //         array_shift($list03);
+    //         array_shift($list04);
+    //     }
+    //     debug_log("InAndOUT","排序后的队列:".json_encode($list01));
+    //     debug_log("InAndOUT","排序后的队列:".json_encode($list02));
+    //     debug_log("InAndOUT","排序后的队列:".json_encode($list03));
+    //     debug_log("InAndOUT","排序后的队列:".json_encode($list04));
+    //     $rssi1= array_sum($list01)/count($list01);
+    //     $rssi2= array_sum($list02)/count($list02);
+    //     $rssi3= array_sum($list03)/count($list03);
+    //     $rssi4= array_sum($list04)/count($list04);
+    //     $res=[$rssi1,$rssi2,$rssi3,$rssi4];
+    //     debug_log("InAndOUT","结算后的结果:".json_encode($res));
+    //     return $res;
+    // }
 /**
  * 获取远程推送的数据
  *
@@ -349,6 +352,7 @@ class dispose
  */
 
 public function getRemoteData($data){
+
     $key="push_data";
     $redis=$this->redis;
     $redis->Rpush($key,json_encode($data));
@@ -489,6 +493,34 @@ public function second_create_direction($mac,$label){
     return ["dirt"=>$res,"time"=>$time];
 
 }
+/**
+ * Undocumented function 基站配置
+ *
+ * @param [type] $mac
+ * @return void
+ */
+
+public function get_station_config($mac){
+     
+     $Key="station_config";
+     $mackey=$mac;
+     $data=[
+        "filter_signal"=>72,//过滤信号强度
+        "history_filter_signal"=>82,//历史记录过滤的信号强度
+        "init_data"=>3, //需要三条数据确定初始方向
+        "change_data"=>5, //需要5条数据确定变换的方向
+        "timeout"=>6,
+        "second_create_res"=>[]//二次根据历史记录生成配置 数组中的参数配置  start_time,end_time,dir 1 前 2后;
+     ];
+     $config_data=$this->selectHash($Key,$mackey);
+     if(!empty($config_data)){
+        foreach($data as $key=>$value){
+            $data[$key]=empty($config_data[$key])?$data[$key]:$config_data[$key];
+        }
+     }
+    return $data;
+
+}
 
 
 
@@ -496,6 +528,34 @@ public function second_create_direction($mac,$label){
 
 
 
+
+
+    /**
+     * function 设置存储结果的时间
+     *
+     * @param [type] $mac
+     * @param [type] $label
+     * @param [type] $time
+     * @return void
+     */
+    public function set_time_results($mac,$label,$time){
+        $mac_key=$mac."res_time";
+        $this->setHash($mac_key,$label,$time);
+    }
+    /**
+     * function 获取存储结果的时间
+     *
+     * @param [type] $mac
+     * @param [type] $label
+     * @return void
+     */
+    public function get_time_results($mac,$label){
+        $mac_key=$mac."res_time";
+        return $this->selectHash($mac_key,$label);
+    }
+
+
+
     //查询key hash
     public function selectHash($hashKey,$key){
         $res= $this->redis->hGet($hashKey,$key);
@@ -515,7 +575,7 @@ public function second_create_direction($mac,$label){
     }
 
     public function temporary_label($redis,$label,$type){
-        
+
         return;
         $key="temporary_label";
         if($type==1){
@@ -574,7 +634,7 @@ public function second_create_direction($mac,$label){
 
     }
 
-
+