From 4a6326f1b7789ef01fefb9b614489f71310b9653 Mon Sep 17 00:00:00 2001 From: ljl Date: Fri, 28 Apr 2023 13:28:58 +0800 Subject: [PATCH] yh --- app/Helper/OmiPay/Signer.php | 4 +++- app/Service/PaymentService.php | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Helper/OmiPay/Signer.php b/app/Helper/OmiPay/Signer.php index d30a8c0..e8471d8 100644 --- a/app/Helper/OmiPay/Signer.php +++ b/app/Helper/OmiPay/Signer.php @@ -7,7 +7,9 @@ namespace App\Helper\OmiPay; class Signer { public static function sign($params) { - $signString = $params['m_number'] . '&' + $mNumber = $params['m_number'] ?? ''; + $mNumber = $mNumber ? $mNumber : Config::get('app_id'); + $signString = $mNumber . '&' . $params['timestamp'] . '&' . $params['nonce_str'] . '&' . Config::get('secret_key'); diff --git a/app/Service/PaymentService.php b/app/Service/PaymentService.php index 3ab74dd..977ecaf 100644 --- a/app/Service/PaymentService.php +++ b/app/Service/PaymentService.php @@ -96,6 +96,9 @@ class PaymentService extends AbstractService } $order = Order::where('order_no', $params['out_order_no'])->where('status', Order::STATUS_WAIT_PAY)->first(); + if (!$order) { + return 'ORDER FAIL'; + } $app = App::where('app_id', $order->app_id)->first(); $order->status = Order::STATUS_PAYED; $order->payed_at = date('Y-m-d H:i:s'); @@ -104,7 +107,7 @@ class PaymentService extends AbstractService if (!$order->save()) { return 'NOTIFY FAIL'; } - + Log::info('notifyToOut url:' . $order->notify_url, 'omipay'); $result = Notification::post($order->notify_url, $this->buildNotifyParams($order, $app)); if ($result != 'SUCCESS') {