捕获错误
This commit is contained in:
parent
2b89b5527a
commit
08794dd9d8
@ -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 = '订单异常';
|
||||
|
Loading…
x
Reference in New Issue
Block a user