|
@@ -76,6 +76,7 @@ class Api extends CatchController
|
|
|
$dispose->setStations($mac,$time);
|
|
|
$list=[];
|
|
|
$text=$text.$data['cnt'];
|
|
|
+ $assetDataArr = [];
|
|
|
|
|
|
if(strlen($text)<24){
|
|
|
continue;
|
|
@@ -123,8 +124,8 @@ class Api extends CatchController
|
|
|
$rssiIn = 72;
|
|
|
|
|
|
//安装调测代码
|
|
|
- $de_macs = ['638006','638007', '631176'];
|
|
|
- $de_rfids = ['E2B6A925', '0200C1D2', '0200C1D1'];
|
|
|
+ $de_macs = ['638004','638001','638003'];
|
|
|
+ $de_rfids = ['52A50A09','52A4E019'];
|
|
|
if (in_array($mac, $de_macs) && in_array($label, $de_rfids)){
|
|
|
$deDa = $DA;
|
|
|
$deDa['time'] = date("Y-m-d H:i:s",$time);
|
|
@@ -133,69 +134,81 @@ class Api extends CatchController
|
|
|
}
|
|
|
|
|
|
//资产盘点调测代码
|
|
|
- if ($mac == '634669' || $mac == '898989') {
|
|
|
- # code...
|
|
|
- $assetData = [
|
|
|
- 'label' => $label,
|
|
|
- 'ant' => 1,
|
|
|
- 'rssi' => $DA['rssi1'],
|
|
|
- 'time' => $time,
|
|
|
- ];
|
|
|
- $ues_redis->lpush('asset_after_handle',json_encode($deDa));
|
|
|
- }
|
|
|
+ // if (in_array($mac, $de_macs) && in_array($label, $de_rfids)) {
|
|
|
+ // # code...
|
|
|
+ // $assetData = [
|
|
|
+ // 'label' => $label,
|
|
|
+ // 'ant' => 1,
|
|
|
+ // 'rssi' => $DA['rssi1'],
|
|
|
+ // 'time' => $time,
|
|
|
+ // ];
|
|
|
+ // array_push($assetDataArr, $assetData);
|
|
|
+
|
|
|
+ // }else{
|
|
|
+ if ($mac == '638007') {
|
|
|
+ # code...
|
|
|
+ $rssiIn = 60;
|
|
|
+ }
|
|
|
+
|
|
|
+ if($DA['rssi1']<=$rssiIn||$DA['rssi2']<=$rssiIn||$DA['rssi3']<=$rssiIn||$DA['rssi4']<=$rssiIn){
|
|
|
+ //原始数据只要其中有一条信号小于72 都参与计算
|
|
|
+ $vs=true;
|
|
|
+ }
|
|
|
+ $DA['rssi1']=$DA['rssi1']==255?100:$DA['rssi1'];
|
|
|
+ $DA['rssi2']=$DA['rssi2']==255?100:$DA['rssi2'];
|
|
|
+ $DA['rssi3']=$DA['rssi3']==255?100:$DA['rssi3'];
|
|
|
+ $DA['rssi4']=$DA['rssi4']==255?100:$DA['rssi4'];
|
|
|
+
|
|
|
+ $DA["rssi1"]=$DA["rssi1"]<=$DA["rssi3"]?$DA["rssi1"]:$DA["rssi3"];
|
|
|
+ $DA["rssi2"]=$DA["rssi2"]<=$DA["rssi4"]?$DA["rssi2"]:$DA["rssi4"];
|
|
|
+ /**
|
|
|
+ * 缓存到redis中历史数据
|
|
|
+ */
|
|
|
+ if(substr($da,8,2)=='01'&&$history_status&&$DA["rssi1"]!=$DA["rssi2"]){
|
|
|
+
|
|
|
+ debug_log("label_log","cache: ".json_encode($DA));
|
|
|
+ $diff= $DA["rssi1"]-$DA["rssi2"];
|
|
|
+ if(abs($diff)>2){
|
|
|
+ //历史数据朝前和朝后的信号的差值大于2参与存储
|
|
|
+ $dispose->set_label_history($DA);
|
|
|
+ }
|
|
|
+ debug_log("label_log","cache_diff: ".$diff);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 参与计算的数据
|
|
|
+ */
|
|
|
+
|
|
|
+ if($vs&&(substr($da,8,2)=='01')){
|
|
|
+ try{
|
|
|
+ $DA= $dispose->check_data($DA);
|
|
|
+ //处理的数据参与计算
|
|
|
+ debug_log("label_log","xsj:".json_encode($DA));
|
|
|
+
|
|
|
+ $dispose->computeResout($DA);
|
|
|
+ }catch(Exception $e){
|
|
|
+ debug_log("InAndOUT","抛出异常:".$e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
- if ($mac == '638007') {
|
|
|
- # code...
|
|
|
- $rssiIn = 60;
|
|
|
- }
|
|
|
|
|
|
- if($DA['rssi1']<=$rssiIn||$DA['rssi2']<=$rssiIn||$DA['rssi3']<=$rssiIn||$DA['rssi4']<=$rssiIn){
|
|
|
- //原始数据只要其中有一条信号小于72 都参与计算
|
|
|
- $vs=true;
|
|
|
- }
|
|
|
- $DA['rssi1']=$DA['rssi1']==255?100:$DA['rssi1'];
|
|
|
- $DA['rssi2']=$DA['rssi2']==255?100:$DA['rssi2'];
|
|
|
- $DA['rssi3']=$DA['rssi3']==255?100:$DA['rssi3'];
|
|
|
- $DA['rssi4']=$DA['rssi4']==255?100:$DA['rssi4'];
|
|
|
-
|
|
|
- $DA["rssi1"]=$DA["rssi1"]<=$DA["rssi3"]?$DA["rssi1"]:$DA["rssi3"];
|
|
|
- $DA["rssi2"]=$DA["rssi2"]<=$DA["rssi4"]?$DA["rssi2"]:$DA["rssi4"];
|
|
|
- /**
|
|
|
- * 缓存到redis中历史数据
|
|
|
- */
|
|
|
- if(substr($da,8,2)=='01'&&$history_status&&$DA["rssi1"]!=$DA["rssi2"]){
|
|
|
-
|
|
|
- debug_log("label_log","cache: ".json_encode($DA));
|
|
|
- $diff= $DA["rssi1"]-$DA["rssi2"];
|
|
|
- if(abs($diff)>2){
|
|
|
- //历史数据朝前和朝后的信号的差值大于2参与存储
|
|
|
- $dispose->set_label_history($DA);
|
|
|
- }
|
|
|
- debug_log("label_log","cache_diff: ".$diff);
|
|
|
- }
|
|
|
- /**
|
|
|
- * 参与计算的数据
|
|
|
- */
|
|
|
-
|
|
|
- if($vs&&(substr($da,8,2)=='01')){
|
|
|
- try{
|
|
|
- $DA= $dispose->check_data($DA);
|
|
|
- //处理的数据参与计算
|
|
|
- debug_log("label_log","xsj:".json_encode($DA));
|
|
|
-
|
|
|
- $dispose->computeResout($DA);
|
|
|
- }catch(Exception $e){
|
|
|
- debug_log("InAndOUT","抛出异常:".$e->getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
$text=substr($text,24);
|
|
|
}else{
|
|
|
$text=substr($text,1);
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
+ if (!empty($assetDataArr)) {
|
|
|
+ # code...
|
|
|
+ $assetPushData = [
|
|
|
+ 'mac' => $mac,
|
|
|
+ 'data' => $assetDataArr
|
|
|
+ ];
|
|
|
+ $ues_redis->lpush('asset_after_handle',json_encode($assetPushData));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|