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.
102 lines
3.3 KiB
102 lines
3.3 KiB
<?php
|
|
// 检查请求方法是否为POST
|
|
|
|
// 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请求的处理
|
|
// // ...
|
|
// }
|
|
|
|
session_start();
|
|
$logFilePath = './wxlogde_decrypt.txt'; // 日志文件保存路径
|
|
file_put_contents($logFilePath, "message:\n\r", LOCK_EX);
|
|
|
|
// $openid = $_SESSION['openid'];
|
|
// $template_id = '5JCt5gNGM7sfwWnRqwWsjH138DixCFJ7sPEbToYQAmQ';
|
|
// $access_token = $_SESSION['access_token'];
|
|
|
|
// file_put_contents($logFilePath, $openid, FILE_APPEND | LOCK_EX);
|
|
// file_put_contents($logFilePath, "\n\r", FILE_APPEND | LOCK_EX);
|
|
// file_put_contents($logFilePath, $access_token, FILE_APPEND | LOCK_EX);
|
|
|
|
// // test_sc
|
|
// // 构造模板消息内容
|
|
// $template_data = array(
|
|
// 'touser' => $openid,
|
|
// 'template_id' => $template_id,
|
|
// 'url' => '', //点击模板消息跳转的URL
|
|
// 'data' => array(
|
|
// 'key1' => array('value' => 'value1'),
|
|
// 'key2' => array('value' => 'value2'),
|
|
// 'key3' => array('value' => 'value3'),
|
|
// ),
|
|
// );
|
|
|
|
// // 发送模板消息
|
|
// $url = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $access_token;
|
|
|
|
// $ch = curl_init();
|
|
// curl_setopt($ch, CURLOPT_URL, $url);
|
|
// curl_setopt($ch, CURLOPT_POST, 1);
|
|
// curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($template_data));
|
|
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
// $response = curl_exec($ch);
|
|
// curl_close($ch);
|
|
|
|
// // 处理响应结果
|
|
// if ($response === false) {
|
|
// // 模板消息发送失败
|
|
// echo '发送模板消息失败!';
|
|
// } else {
|
|
// $result = json_decode($response, true);
|
|
// if ($result['errcode'] == 0) {
|
|
// // 模板消息发送成功
|
|
// echo '发送模板消息成功!';
|
|
// } else {
|
|
// // 模板消息发送失败
|
|
// echo '发送模板消息失败!' . $result['errmsg'];
|
|
// }
|
|
// }
|
|
|
|
// 获取异步回调的数据
|
|
$postData = file_get_contents('php://input');
|
|
|
|
file_put_contents($logFilePath, "here1\n\r", FILE_APPEND | LOCK_EX);
|
|
|
|
// BASE_PATH有问题 在这里无法取到BASE_PATH的值
|
|
// 一种解决方案:直接将服务器上的路径写到这里
|
|
require_once("/data/www/wwwroot/dcs1.3/mobile/source/". 'helpers/dalianpay/demo/dalianpay.php');
|
|
file_put_contents($logFilePath, "here2\n\r", FILE_APPEND | LOCK_EX);
|
|
$new_plugin = new dalianpay();
|
|
|
|
file_put_contents($logFilePath, "here3\n\r", FILE_APPEND | LOCK_EX);
|
|
// $response_data = $new_plugin->query($postData);
|
|
|
|
// 添加时间戳和换行符
|
|
$logMessage = date('Y-m-d H:i:s') . " - " . $response_data . "\n";
|
|
|
|
// 将日志写入文件
|
|
file_put_contents($logFilePath, $logMessage, FILE_APPEND | LOCK_EX);
|
|
|
|
?>
|