加redis日志
This commit is contained in:
@@ -230,8 +230,10 @@ class Payment extends Controller
|
|||||||
$timestamp = input("timestamp", "");
|
$timestamp = input("timestamp", "");
|
||||||
$sign = input("sign", "");
|
$sign = input("sign", "");
|
||||||
Log::record("云账户回调信息".json_encode($_POST),"info");
|
Log::record("云账户回调信息".json_encode($_POST),"info");
|
||||||
|
write_log_redis("yunzhanghu_huidiao_原始数据",$_POST);
|
||||||
$yun_pay = new YunPay();
|
$yun_pay = new YunPay();
|
||||||
$result = $yun_pay->yun_callback($data,$mess,$timestamp,$sign);
|
$result = $yun_pay->yun_callback($data,$mess,$timestamp,$sign);
|
||||||
|
write_log_redis("yunzhanghu_huidiao_解密后数据",$result);
|
||||||
if($result['code']==1){
|
if($result['code']==1){
|
||||||
$data = $result['data'];
|
$data = $result['data'];
|
||||||
if($data){
|
if($data){
|
||||||
|
|||||||
@@ -1281,6 +1281,22 @@ function getMillisecond() {
|
|||||||
return (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
|
return (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 写入日志到redis
|
||||||
|
* @param string $key 日志key
|
||||||
|
* @param array $logData 日志数据
|
||||||
|
*/
|
||||||
|
function write_log_redis($key = 'log',$logData = [],$time = 7){
|
||||||
|
$redis = new \Redis();
|
||||||
|
// 连接到Redis服务器
|
||||||
|
$redis->connect(config('redis.host'), config('redis.port')); // 根据实际配置调整主机和端口
|
||||||
|
// 选择数据库2
|
||||||
|
$redis->select(2);
|
||||||
|
$key = $key.'_'.date('Y-m-d-H-i-s');
|
||||||
|
$expire = 86400 * $time;
|
||||||
|
$redis->setex($key, $expire, json_encode($logData));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user