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 {