|
@@ -174,6 +174,10 @@ class Api extends CatchController
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 清除数据
|
|
|
*
|
|
@@ -260,10 +264,11 @@ class Api extends CatchController
|
|
|
];
|
|
|
// debug_log("InAndOUT","得出计算结果:".json_encode($arr));
|
|
|
debug_log("clear_label","发送给远程".json_encode($url_data));
|
|
|
- $url="http://47.114.185.186:8115/api/accessReport";
|
|
|
- $url_res= curl_http_post(json_encode($url_data),$url,false);
|
|
|
- debug_log("clear_label","远程返回结果".$url_res);
|
|
|
- debug_log("result","补充计算出的结果计算返回的结果".json_encode($url_data));
|
|
|
+ // $url="http://47.114.185.186:8115/api/accessReport";
|
|
|
+ // $url_res= curl_http_post(json_encode($url_data),$url,false);
|
|
|
+ // debug_log("clear_label","远程返回结果".$url_res);
|
|
|
+ // debug_log("result","补充计算出的结果计算返回的结果".json_encode($url_data));
|
|
|
+ $dispose->getRemoteData($url_data);
|
|
|
$this->temporary_label($redis,$item,2);
|
|
|
|
|
|
}else{
|
|
@@ -287,15 +292,78 @@ class Api extends CatchController
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 远程推送数据
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function remotePush(){
|
|
|
+ while(true){
|
|
|
+ $redis=Cache::store('redis')->handler();
|
|
|
+ $key="push_data";
|
|
|
+ $url="http://47.114.185.186:8115/api/accessReport";
|
|
|
+ //$url="http://127.0.0.1:8000/api/accessReport";
|
|
|
+ sleep(2);
|
|
|
+ while($data=$redis->lPop($key)){
|
|
|
+ if(!empty($data)){
|
|
|
+ debug_log($key,"远程推送的数据".$data);
|
|
|
+ $url_res= curl_http_post($data,$url,false);
|
|
|
+ $num=1;
|
|
|
+ while($url_res==false){
|
|
|
+ $num++;
|
|
|
+ $url_res= curl_http_post($data,$url,false);
|
|
|
+ if($num>=3){
|
|
|
+ debug_log($key,"远程推送的地址".$url);
|
|
|
+ debug_log($key,"连续推送三次失败,远程推送的数据".$data);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ debug_log($key,"远程返回结果".$url_res);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+ // 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));
|
|
|
+
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public function redis_to_mysql_parea(){
|
|
|
|
|
|
$ues_redis=Cache::store('redis')->handler();
|