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);