From 59711b649574b2e2a2d407de7fcc63382d85a8dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Mon, 20 Dec 2021 11:12:28 +0800 Subject: [PATCH] WIP --- app/Services/OrderService.php | 50 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index fc046c06..485a866f 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -616,6 +616,31 @@ class OrderService throw new BizException('支付方式不支持'); } + /** + * 支付成功 + * + * @param string $sn + * @param array $params + * @return void + */ + public function paySuccess(string $sn, array $params = []): void + { + $order = Order::where('sn', $sn)->firstOrFail(); + + if (! $order->isPending()) { + throw new BizException('订单状态不是待支付'); + } + + $order->update([ + 'pay_sn' => $params['pay_sn'], + 'pay_way' => $params['pay_way'], + 'pay_at' => $params['pay_at'], + 'status' => Order::STATUS_PAID, + ]); + + // todo 处理预收益 + } + /** * 更新包裹状态 * @@ -715,29 +740,4 @@ class OrderService ]); } } - - /** - * 支付成功 - * - * @param string $sn - * @param array $params - * @return void - */ - public function paySuccess(string $sn, array $params = []): void - { - $order = Order::where('sn', $sn)->firstOrFail(); - - if (! $order->isPending()) { - throw new BizException('订单状态不是待支付'); - } - - $order->update([ - 'pay_sn' => $params['pay_sn'], - 'pay_way' => $params['pay_way'], - 'pay_at' => $params['pay_at'], - 'status' => Order::STATUS_PAID, - ]); - - // todo 处理预收益 - } }