From 59115fbf691df38b79575272d29ea87d071683ab Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Tue, 23 Sep 2025 17:42:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/application/common/config/route.php | 2 +- Server/application/common/controller/PaymentService.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Server/application/common/config/route.php b/Server/application/common/config/route.php index c5573f58..fc94c79b 100644 --- a/Server/application/common/config/route.php +++ b/Server/application/common/config/route.php @@ -24,7 +24,7 @@ Route::group('v1/', function () { Route::group('v1/pay', function () { Route::post('', 'app\cunkebao\controller\Pay@createOrder')->middleware(['jwt']); - Route::post('notify', 'app\common\controller\PaymentService@notify'); + Route::any('notify', 'app\common\controller\PaymentService@notify'); }); diff --git a/Server/application/common/controller/PaymentService.php b/Server/application/common/controller/PaymentService.php index 969731b0..b34f1e41 100644 --- a/Server/application/common/controller/PaymentService.php +++ b/Server/application/common/controller/PaymentService.php @@ -42,10 +42,12 @@ class PaymentService 'body' => $order['goodsName'] ?? '', 'total_fee' => $order['money'] ?? 0, 'mch_create_ip' => Request::ip(), - 'notify_url' => Env::get('payment.notify_url',''), + 'notify_url' => Env::get('payment.notify_url','127.0.0.1'), 'nonce_str' => PaymentUtil::generateNonceStr(), ]; + exit_data($params); + Db::startTrans(); try { // 过滤空值签名 @@ -202,6 +204,8 @@ class PaymentService */ public function notify() { + Log::info('支付结果异步通知'); + $rawBody = file_get_contents('php://input'); Log::info('[SwiftPass][notify] raw: ' . $rawBody);