elf 1 year ago
parent 9651a08abf
commit 635048a6ae

@ -110,7 +110,7 @@ class NotifyController extends AbstractController
'transaction_id' => $params['transactionId'] ?? '', 'transaction_id' => $params['transactionId'] ?? '',
'out_transaction_id' => $params['outTransactionId'] ?? '', 'out_transaction_id' => $params['outTransactionId'] ?? '',
]; ];
$order = $this->paymentService->updateOrder($info); $order = $this->paymentService->updateOrder($info, 'APPLY_SUCCESS');
if (empty($order)) { if (empty($order)) {
return $baofu->notifySuccess(); return $baofu->notifySuccess();
} }
@ -151,7 +151,7 @@ class NotifyController extends AbstractController
'amount' => $params['orderMoney'], 'amount' => $params['orderMoney'],
'finished_at' => $params['finishTime'], 'finished_at' => $params['finishTime'],
]; ];
$order = $this->paymentService->updateOrder($info, 'PROCESS'); $order = $this->paymentService->updateOrder($info, 'SUCCESS');
if (empty($order)) { if (empty($order)) {
return $baofu->notifySuccess(); return $baofu->notifySuccess();
} }

@ -261,11 +261,12 @@ class PaymentService extends AbstractService
return [$order, $orderSplitInfos]; return [$order, $orderSplitInfos];
} }
public function updateOrder($params, $status = 'APPLY_SUCCESS') { public function updateOrder($params, $status = null) {
$order = Order::where('order_no', $params['order_no'])->where('status', $status)->first(); $order = Order::where('order_no', $params['order_no'])->first();
if (empty($order)) { if (empty($order)) {
return null; return null;
} }
$order->third_order_no = $params['third_order_no']; $order->third_order_no = $params['third_order_no'];
$order->status = $params['status']; $order->status = $params['status'];
$order->finished_at = date('Y-m-d H:i:s', strtotime($params['finished_at'])); $order->finished_at = date('Y-m-d H:i:s', strtotime($params['finished_at']));
@ -479,7 +480,7 @@ class PaymentService extends AbstractService
if (empty($order)) { if (empty($order)) {
throw new BusinessException('订单不存在'); throw new BusinessException('订单不存在');
} }
try {
$baofu = new Baofu(); $baofu = new Baofu();
$result = $baofu->queryOrder([ $result = $baofu->queryOrder([
'loginNo' => $order->member_id, 'loginNo' => $order->member_id,
@ -498,8 +499,6 @@ class PaymentService extends AbstractService
'out_transaction_id' => $result['outTransactionId'] ?? '', 'out_transaction_id' => $result['outTransactionId'] ?? '',
]; ];
return $this->updateOrder($info); return $this->updateOrder($info);
} catch (ApiException $e) {
throw $e;
}
} }
} }

Loading…
Cancel
Save