|
@@ -216,18 +216,21 @@ class Api extends CatchController
|
|
debug_log("clear_label",'标签'.$item);
|
|
debug_log("clear_label",'标签'.$item);
|
|
debug_log("clear_label",'获取的数据'.$json_data);
|
|
debug_log("clear_label",'获取的数据'.$json_data);
|
|
$json_data=json_decode($json_data,true);
|
|
$json_data=json_decode($json_data,true);
|
|
|
|
+ //列表
|
|
$a=$json_data['a'];
|
|
$a=$json_data['a'];
|
|
|
|
+ //状态
|
|
$status=$json_data['status'];
|
|
$status=$json_data['status'];
|
|
|
|
+ //进出
|
|
|
|
+ $in_and_out=$json_data["in_and_out"];
|
|
|
|
+ //总数
|
|
$count= count($a);
|
|
$count= count($a);
|
|
if((time()-$json_data["time"])<8){
|
|
if((time()-$json_data["time"])<8){
|
|
debug_log("clear_label", $item.':'. "标签上报间隔没有超过8秒进行跳过");
|
|
debug_log("clear_label", $item.':'. "标签上报间隔没有超过8秒进行跳过");
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
if($count<5){
|
|
if($count<5){
|
|
- // $redis->hdel($key,$item);
|
|
|
|
debug_log("clear_label", $item.':'. "标签信号个数没有超过5个,全部去清除");
|
|
debug_log("clear_label", $item.':'. "标签信号个数没有超过5个,全部去清除");
|
|
- //continue;
|
|
|
|
-
|
|
|
|
|
|
+
|
|
}else{
|
|
}else{
|
|
$front=0;
|
|
$front=0;
|
|
$back=0;
|
|
$back=0;
|
|
@@ -274,27 +277,31 @@ class Api extends CatchController
|
|
$this->temporary_label($redis,$item,2);
|
|
$this->temporary_label($redis,$item,2);
|
|
|
|
|
|
}else{
|
|
}else{
|
|
|
|
+
|
|
|
|
+ if(empty($in_and_out)){
|
|
|
|
+ //二次生成结果
|
|
|
|
+ $res=$dispose->second_create_direction($station,$item);
|
|
|
|
+ if(!empty($res)){
|
|
|
|
+ debug_log("clear_label", $item.':'. "二次生成进出");
|
|
|
|
+ $data_array=[];
|
|
|
|
+ $data_array[]=[
|
|
|
|
+ "label"=>$item,
|
|
|
|
+ 'time'=>$res['time'],
|
|
|
|
+ 'dirt'=>$res['dirt'],
|
|
|
|
+ ];
|
|
|
|
+ $url_data=[
|
|
|
|
+ "mac"=>$station,
|
|
|
|
+ "data"=>$data_array
|
|
|
|
+ ];
|
|
|
|
+ debug_log("clear_label","二次生成发送给远程".json_encode($url_data));
|
|
|
|
+ //远程推送
|
|
|
|
+ $dispose->getRemoteData($url_data);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
//二次进出
|
|
//二次进出
|
|
- $res=$dispose->second_create_direction($station,$item);
|
|
|
|
-
|
|
|
|
- if(!empty($res)){
|
|
|
|
- debug_log("clear_label", $item.':'. "二次生成进出");
|
|
|
|
- $data_array=[];
|
|
|
|
- $data_array[]=[
|
|
|
|
- "label"=>$item,
|
|
|
|
- 'time'=>$res['time'],
|
|
|
|
- 'dirt'=>$res['dirt'],
|
|
|
|
- ];
|
|
|
|
- $url_data=[
|
|
|
|
- "mac"=>$station,
|
|
|
|
- "data"=>$data_array
|
|
|
|
- ];
|
|
|
|
- // debug_log("InAndOUT","得出计算结果:".json_encode($arr));
|
|
|
|
- debug_log("clear_label","二次生成发送给远程".json_encode($url_data));
|
|
|
|
- //远程推送
|
|
|
|
- $dispose->getRemoteData($url_data);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
debug_log("clear_label", $item.':'. "最后一个信号,方向没有变化,清除缓存数据");
|
|
debug_log("clear_label", $item.':'. "最后一个信号,方向没有变化,清除缓存数据");
|
|
|
|
|
|
}
|
|
}
|
|
@@ -312,9 +319,6 @@ class Api extends CatchController
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -359,27 +363,6 @@ class Api extends CatchController
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- // public function test2(){
|
|
|
|
- // while(true){
|
|
|
|
- // // $data='{"mac":"863488051843244","data":[{"label":"E2B81F15","time":1683886407,"dirt":1}]}';
|
|
|
|
- // $data_array=[];
|
|
|
|
- // $data_array[]=[
|
|
|
|
- // "label"=>"E2B81F15",
|
|
|
|
- // 'time'=>1683886407,
|
|
|
|
- // 'dirt'=>1 //1是进 2是出
|
|
|
|
- // ];
|
|
|
|
- // $url_data=[
|
|
|
|
- // "mac"=>"863488051843244",
|
|
|
|
- // "data"=>$data_array
|
|
|
|
- // ];
|
|
|
|
- // sleep(10);
|
|
|
|
- // $key="push_data";
|
|
|
|
- // $redis=Cache::store('redis')->handler();
|
|
|
|
- // $redis->Rpush($key,json_encode($url_data));
|
|
|
|
-
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- // }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|