From aba84bb9202829ae9c1961fed4484751d879e3bf Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 5 Jun 2024 09:45:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(PaymentLogic):=20=E7=AE=80=E5=8C=96?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=A4=9A=E4=BD=99=E7=9A=84=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PaymentLogic.php | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/app/common/logic/PaymentLogic.php b/app/common/logic/PaymentLogic.php index 2ff5a38d8..cbfb33b1e 100644 --- a/app/common/logic/PaymentLogic.php +++ b/app/common/logic/PaymentLogic.php @@ -7,9 +7,7 @@ namespace app\common\logic; use app\common\enum\PayEnum; use app\common\model\user\UserAuth; use app\common\service\pay\PayService; -use Illuminate\Support\Facades\Log; -use Yansongda\Artful\Exception\Exception as ExceptionException; -use Yansongda\Pay\Exception\Exception; +use Exception; use function DI\string; @@ -57,19 +55,15 @@ class PaymentLogic extends BaseLogic 'attach' => $from ]; $wechat = new PayService(1); - - // 尝试执行可能会抛出异常的代码 - $result = $wechat->wechat->mini($order)->toArray(); - \support\Log::info(json_encode($result)); - + $result = $wechat->wechat->mini($order)->toArray(); break; default: self::$error = '订单异常'; $result = false; } - } catch (ExceptionException $e) { - \support\Log::info($e->getMessage()); - throw new \Exception($e->getMessage()); + } catch (Exception $e) { + \support\Log::info($e->extra['message']); + throw new \Exception($e->extra['message']); } return $result; } @@ -103,7 +97,7 @@ class PaymentLogic extends BaseLogic $wechat = new PayService(1); try { $result = $wechat->wechat->pos($order)->toArray(); - } catch (ExceptionException $e) { + } catch (Exception $e) { if (getenv('APP_DEBUG') == true) { self::$error = $e->extra['message'] ?? $e->getMessage(); } else { @@ -135,7 +129,7 @@ class PaymentLogic extends BaseLogic $wechat = new PayService(); try { $result = $wechat->alipay->pos($order)->toArray(); - } catch (ExceptionException $e) { + } catch (Exception $e) { if (getenv('APP_DEBUG') == true) { self::$error = $e->extra['message'] ?? $e->getMessage(); } else {