|
@@ -501,16 +501,22 @@ public function second_create_direction($mac,$label){
|
|
|
}
|
|
|
|
|
|
$befor_res= $this->get_time_results($mac,$label,2);
|
|
|
- debug_log("second_dirt","间隔时间".json_encode($befor_res));
|
|
|
- if($befor_res['dir']==$res){
|
|
|
- $interval_time=$time-$befor_res["time"];
|
|
|
- debug_log("second_dirt","间隔时间".$interval_time);
|
|
|
- debug_log("second_dirt","间隔时间第一个小时,且方向相同 不做二次计算".$interval_time);
|
|
|
- if($interval_time<1*60*60){
|
|
|
- return false;
|
|
|
+
|
|
|
+ if(!empty($befor_res)){
|
|
|
+ debug_log("second_dirt","间隔时间".json_encode($befor_res));
|
|
|
+ if($befor_res['dir']==$res){
|
|
|
+ $interval_time=$time-$befor_res["time"];
|
|
|
+ debug_log("second_dirt","间隔时间".$interval_time);
|
|
|
+ debug_log("second_dirt","间隔时间第一个小时,且方向相同 不做二次计算".$interval_time);
|
|
|
+ if($interval_time<1*60*60){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ }else{
|
|
|
+ debug_log("second_dirt","数据为空,进行生成");
|
|
|
}
|
|
|
+
|
|
|
|
|
|
|
|
|
debug_log("second_dirt","最终结果".json_encode(["dirt"=>$res,"time"=>$time]));
|
|
@@ -579,6 +585,9 @@ public function get_station_config($mac){
|
|
|
public function get_time_results($mac,$label,$type=1){
|
|
|
$mac_key=$mac."res_time";
|
|
|
$data=$this->selectHash($mac_key,$label);
|
|
|
+ if(empty($data)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
if($type==1){
|
|
|
return $data["time"];
|
|
|
}else{
|