From c2925811d51feac1e03ce8f7492ddd86a72be30f Mon Sep 17 00:00:00 2001 From: yangrz Date: Mon, 22 Aug 2022 15:28:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/CcbPaymentService.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Service/v3/CcbPaymentService.php b/app/Service/v3/CcbPaymentService.php index 2f35e78..9bae09e 100644 --- a/app/Service/v3/CcbPaymentService.php +++ b/app/Service/v3/CcbPaymentService.php @@ -506,7 +506,7 @@ class CcbPaymentService ->where('created_at', '>=', (time() - 900)) ->first(); if (empty($orderMain)) { - throw new ErrorCodeException(ErrorCode::ORDER_NOT_AVAILABLE, '[支付订单号]'.$globalOrderId); + throw new BusinessException(ErrorCode::ORDER_NOT_AVAILABLE, '[订单号无效]'.$globalOrderId); } $user = User::select('openid')->find($userId); @@ -539,12 +539,12 @@ class CcbPaymentService $selfProfitRatio = config('ccb.self_profit_ratio'); if (bccomp($selfProfitRatio, '0', 3) == 0) { - throw new BusinessException(500, '未配置分润比例,请联系管理员'); + throw new BusinessException(500, '[未配置分润比例]'); } foreach ($orderMain->orders as $order) { if (empty($order->store->ccb_merchant_id)) { - throw new BusinessException(500, '店铺'.$order->store_id.'未配置商户编号,请联系管理员'); + throw new BusinessException(500, '[店铺未配置商家编号]'.$order->store_id); } foreach ($order->orderGoods as $orderGoods) { $goodsMoney = bcmul($orderGoods->price, (string)$orderGoods->number, 2); @@ -588,7 +588,7 @@ class CcbPaymentService $model->py_trn_no = $result['Py_Trn_No']; $model->prim_ordr_no = $result['Prim_Ordr_No']; - $model->ordr_gen_tm = $result['Ittparty_Tms']; + $model->ordr_gen_tm = $result['Ordr_Gen_Tm']; if (isset($result['Cshdk_Url'])) { $model->cshdk_url = $result['Cshdk_Url']; } @@ -621,7 +621,8 @@ class CcbPaymentService } catch (\Exception $e) { $this->log->event(LogLabel::ORDER_PAYMENT_LOG, ['payment_do_exception_msg' => $e->getMessage()]); - throw new ErrorCodeException(ErrorCode::PAYMENT_FAIL, '[稍后重试]'); + $message = $e instanceof BusinessException ? $e->getMessage() : '[稍后重试]'; + throw new ErrorCodeException(ErrorCode::PAYMENT_FAIL, $message); } }