git 2 rokov pred
rodič
commit
8d5ee0e09c

+ 0 - 2
.data/log/route/2022-10-09/tslog/route_error.txt

@@ -1,2 +0,0 @@
-[22-10-09 15:37:26]Instantiation RouteTableStore fail EndPoint:  AccessKeyID:  AccessKeySecret:  InstanceName:  OTS_DSN not configed
-[22-10-09 15:37:26]Instantiation RouteRedisStore fail  REDIS_DSN not configed

+ 4 - 0
.data/log/workerman/APP_PREFIX.log

@@ -21,3 +21,7 @@
 2022-11-26 10:20:16 pid:14373 Workerman[index.php] start in DEBUG mode
 2022-11-26 10:23:25 pid:14373 Workerman[index.php] Stopping ...
 2022-11-26 10:23:25 pid:14373 Workerman[index.php] has been stopped
+2022-12-01 16:12:17 pid:8478 Workerman[index.php] start in DEBUG mode
+2022-12-01 16:12:19 pid:8478 Workerman[index.php] Stopping ...
+2022-12-01 16:12:21 pid:8478 worker[none:8645] exit with status 9
+2022-12-01 16:12:21 pid:8478 Workerman[index.php] has been stopped

+ 109 - 0
Home/Common/func.php

@@ -0,0 +1,109 @@
+<?php
+
+ 
+	function api_result( $status, $text, $deviceId ){
+		echo json_encode(array('status'=>$status,'statustext'=>$text),JSON_UNESCAPED_UNICODE);
+		debug_post_log('api_result_log','deviceId '.$deviceId.' status:'.$status.' statustext'.$text);
+		exit;
+			
+	}
+	
+ 
+	function send_post_message( $data ){
+		//dump($data);
+		$post_data=array(
+			'TransId'=>'',
+			'Seq'=>0,
+			'MsgType'=>$data['MsgType'],
+			'DevAddress'=>'192.168.1.10:9996',
+			'DeviceId'=>$data['imei']['value'],
+			'DevType'=>'0',
+			'Data'=>array('ResultAck'=>$data['result']),
+		);
+		
+		$url='http://openapi.rltest.cn/v1/receive_message';
+		$postFields = json_encode($post_data);
+		$ch = curl_init ();
+		curl_setopt( $ch, CURLOPT_URL, $url ); 
+		curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8'));
+		curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
+		curl_setopt( $ch, CURLOPT_POST, 1 );
+		curl_setopt( $ch, CURLOPT_POSTFIELDS, $postFields);
+		curl_setopt( $ch, CURLOPT_TIMEOUT,1); 
+		curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0);
+		curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0);
+		$res=curl_exec ( $ch );
+		var_dump($res);
+		//echo $res;
+		
+	}
+	
+ 
+	function debug_log( $filename, $data ){
+		if(!APP_DEBUG){
+			return;
+		}
+		$file = SOLUTION_LOG_PATH .debug .'/'.date("Ymd", time()) ."/".$filename.".log";
+		$folder=dirname($file);
+		if (!is_dir($folder)){
+			mkdir($folder,0777,true);
+		}
+		//echo '[' . date('Y-m-d H:i:s') . ']' . $data . PHP_EOL;
+		file_put_contents($file, '[' . date('Y-m-d H:i:s') . ']' . $data . PHP_EOL,FILE_APPEND);
+	}
+	
+ 
+	function result_error_log( $data ){
+		$file = SOLUTION_LOG_PATH.error.'/'.date("Y-m-d", time()) ."/"."error.log";
+		$folder=dirname($file);
+		if (!is_dir($folder)){
+			mkdir($folder,0777,true);
+		}
+		//echo '[' . date('Y-m-d H:i:s') . ']' . $data . PHP_EOL;
+		file_put_contents($file, '[' . date('Y-m-d H:i:s') . ']' . $data . PHP_EOL,FILE_APPEND);
+	}
+	
+ 
+	function scanTargetFile( $dir, $ext ){
+		$files = '';
+		if($head = opendir($dir))
+		{
+			while(($file = readdir($head)) !== false)
+			{
+				if($file != ".." && $file!=".")
+				{
+					if(is_dir($dir.'/'.$file))
+					{
+						$files.=scanTargetFile($dir.'/'.$file);
+					}
+					else
+					{
+						$path = $dir.'/'.$file;
+						$pathInfo = pathinfo($path);
+						if($pathInfo['extension'] != 'md5'){
+							continue;
+						}
+						$files.=$path . ';';
+					}
+				}
+			} 
+		}
+		closedir($head);
+		return $files;
+	}
+	
+ 
+	function debug_post_log(  ){
+		if(!APP_DEBUG){
+			return;
+		}
+		$file = SOLUTION_LOG_PATH .debug .'/'.date("Y-m-d", time()) ."/".$filename.".log";
+		$folder=dirname($file);
+		if (!is_dir($folder)){
+			mkdir($folder,0777,true);
+		}
+		//echo '[' . date('Y-m-d H:i:s') . ']' . $data . PHP_EOL;
+		file_put_contents($file, '[' . date('Y-m-d H:i:s') . ']' . $data . PHP_EOL,FILE_APPEND);
+	}
+	
+