ljl 1 year ago
parent ab56ca6fbb
commit aced4299f7

@ -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, 'APPLY_SUCCESS'); $order = $this->paymentService->updateOrder($info, ['APPLY_SUCCESS', 'PROCESS']);
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, 'SUCCESS'); $order = $this->paymentService->updateOrder($info, ['SUCCESS']);
if (empty($order)) { if (empty($order)) {
return $baofu->notifySuccess(); return $baofu->notifySuccess();
} }

@ -261,12 +261,16 @@ class PaymentService extends AbstractService
return [$order, $orderSplitInfos]; 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(); $order = Order::where('order_no', $params['order_no'])->first();
if (empty($order)) { if (empty($order)) {
return null; return null;
} }
if ($statusList && !in_array($order->status, $statusList)) {
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']));

Loading…
Cancel
Save