From ab661096f25210c31a11a7ea022685ec4525c579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Tue, 4 Mar 2025 00:28:07 +0800 Subject: [PATCH] Update PaymentService.php --- plugin/think-plugs-wechat/src/service/PaymentService.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/think-plugs-wechat/src/service/PaymentService.php b/plugin/think-plugs-wechat/src/service/PaymentService.php index 89d14d573..c99efc1ad 100644 --- a/plugin/think-plugs-wechat/src/service/PaymentService.php +++ b/plugin/think-plugs-wechat/src/service/PaymentService.php @@ -153,7 +153,10 @@ class PaymentService $result = empty($notify['result']) ? [] : json_decode($notify['result'], true); p($result, false, 'wechat_pay_notify'); p('------------------', false, 'wechat_pay_notify'); - if (empty($result) || !is_array($result)) return response('error', 500); + if (empty($result) || !is_array($result)) { + empty($data['order']) || self::query($data['order']); + return response('error', 500); + } //订单支付通知处理 if ($data['scen'] === 'order' && isset($result['trade_state']) && $result['trade_state'] == 'SUCCESS') { if ($data['order'] !== $result['out_trade_no']) return response('error', 500); @@ -184,7 +187,7 @@ class PaymentService } return response('success'); } catch (\Exception $exception) { - empty($data['code']) || self::query($data['code']); + empty($data['order']) || self::query($data['order']); return json(['code' => 'FAIL', 'message' => $exception->getMessage()])->code(500); } }