You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.4 KiB

<?php
3 years ago
// 检查请求方法是否为POST
3 years ago
// if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// // 从POST请求中获取支付结果参数,假设参数名为result
// $cusid = $_POST['cusid'];
// $trxcode = $_POST['trxcode'];
// $trxid = $_POST['trxid'];
// $trxamt = $_POST['trxamt'];
// // 根据支付结果进行相应的业务处理
// // if ($paymentResult === 'success') {
// // // 支付成功的操作
// // // ...
// // } else {
// // // 支付失败的操作
// // // ...
// // }
// var_dump($cusid);
// var_dump($trxcode);
// var_dump($trxid);
// var_dump($trxamt);
// // 返回响应给平台,确认接收到通知
// http_response_code(200); // 返回200状态码,表示成功接收到通知
// } else {
// // 非POST请求的处理
// // ...
// }
3 years ago
$logFilePath = './wxlogde_1.txt'; // 日志文件保存路径
3 years ago
// 获取异步回调的数据
$postData = file_get_contents('php://input');
3 years ago
// 解密postData
3 years ago
require_once(BASE_PATH . 'helpers/dalianpay/demo/dalianpay.php');
require_once(BASE_PATH . 'helpers/dalianpay/library/Base.php');
3 years ago
3 years ago
$new_plugin = new dalianpay();
3 years ago
$response_data = $new_plugin->norify_decrypt($postData);
3 years ago
3 years ago
// 添加时间戳和换行符
3 years ago
$logMessage = date('Y-m-d H:i:s') . " - " . $response_data . "\n";
3 years ago
// 将日志写入文件
file_put_contents($logFilePath, $logMessage, FILE_APPEND | LOCK_EX);
?>