Browse Source

modify notify address

master
dutsc 3 years ago
parent
commit
118b0db765
  1. 54
      mobile/plugins/payment/wxnotify.php
  2. 2
      mobile/source/helpers/dalianpay/config/config.php

54
mobile/plugins/payment/wxnotify.php

@ -0,0 +1,54 @@
<?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, "new begin:\n\r", FILE_APPEND | LOCK_EX);
file_put_contents($logFilePath, "here\n\r", FILE_APPEND | LOCK_EX);
// 获取异步回调的数据
$postData = file_get_contents('php://input');
file_put_contents($logFilePath, "here1\n\r", FILE_APPEND | LOCK_EX);
require_once(BASE_PATH . '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);
?>

2
mobile/source/helpers/dalianpay/config/config.php

@ -22,7 +22,7 @@
// 门店号 // 门店号
'branchno' => '401', 'branchno' => '401',
// 交易结果通知地址 // 交易结果通知地址
'notify_url' => 'https://shop.heavenk.com/mobile/source/helpers/wxnorify_helper.php', 'notify_url' => 'https://shop.heavenk.com/mobile/plugins/payment/wxnotify.php',
// 支付限制 // 支付限制
'limit_pay' => 'no_credit', 'limit_pay' => 'no_credit',
// 微信子appid 商户微信号 // 微信子appid 商户微信号

Loading…
Cancel
Save