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 处理预收益 - } }