diff --git a/app/common/logic/PaymentLogic.php b/app/common/logic/PaymentLogic.php index 852e8aa9e..2ae9d5f8b 100644 --- a/app/common/logic/PaymentLogic.php +++ b/app/common/logic/PaymentLogic.php @@ -7,6 +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; @@ -55,7 +56,14 @@ class PaymentLogic extends BaseLogic 'attach' => $from ]; $wechat = new PayService(1); - $result = $wechat->wechat->mini($order)->toArray(); + try { + // 尝试执行可能会抛出异常的代码 + $result = $wechat->wechat->mini($order)->toArray(); + + } catch (\Exception $e) { + \support\Log::info($e->getMessage()); + throw new \Exception($e->getMessage()); + } break; default: self::$error = '订单异常';