From aced4299f78e1a74da9cd3f7e36aff9b16753960 Mon Sep 17 00:00:00 2001 From: ljl Date: Mon, 21 Aug 2023 18:08:18 +0800 Subject: [PATCH] yh --- app/Controller/Payment/NotifyController.php | 4 ++-- app/Service/PaymentService.php | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Controller/Payment/NotifyController.php b/app/Controller/Payment/NotifyController.php index 6c62008..b4d1576 100644 --- a/app/Controller/Payment/NotifyController.php +++ b/app/Controller/Payment/NotifyController.php @@ -110,7 +110,7 @@ class NotifyController extends AbstractController 'transaction_id' => $params['transactionId'] ?? '', 'out_transaction_id' => $params['outTransactionId'] ?? '', ]; - $order = $this->paymentService->updateOrder($info, 'APPLY_SUCCESS'); + $order = $this->paymentService->updateOrder($info, ['APPLY_SUCCESS', 'PROCESS']); if (empty($order)) { return $baofu->notifySuccess(); } @@ -151,7 +151,7 @@ class NotifyController extends AbstractController 'amount' => $params['orderMoney'], 'finished_at' => $params['finishTime'], ]; - $order = $this->paymentService->updateOrder($info, 'SUCCESS'); + $order = $this->paymentService->updateOrder($info, ['SUCCESS']); if (empty($order)) { return $baofu->notifySuccess(); } diff --git a/app/Service/PaymentService.php b/app/Service/PaymentService.php index ce5b105..2b4599c 100644 --- a/app/Service/PaymentService.php +++ b/app/Service/PaymentService.php @@ -261,11 +261,15 @@ class PaymentService extends AbstractService return [$order, $orderSplitInfos]; } - public function updateOrder($params, $status = null) { + public function updateOrder($params, array $statusList = null) { $order = Order::where('order_no', $params['order_no'])->first(); if (empty($order)) { return null; } + + if ($statusList && !in_array($order->status, $statusList)) { + return null; + } $order->third_order_no = $params['third_order_no']; $order->status = $params['status'];