This commit is contained in:
Hankin 2025-08-12 17:53:36 +08:00
parent d109d08f4d
commit 915604c95b

View File

@ -62,16 +62,14 @@ class WechatPayService
/** @see https://docs.guzzlephp.org/en/stable/request-options.html#debug */
// ['debug' => true] // 调试模式
);
echo (string) $resp->getBody(), PHP_EOL;
return $resp->getBody();
} catch (\Exception $e) {
// 进行异常捕获并进行错误判断处理
echo $e->getMessage(), PHP_EOL;
Log::info($e->getMessage());
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
$r = $e->getResponse();
echo $r->getStatusCode() . ' ' . $r->getReasonPhrase(), PHP_EOL;
echo (string) $r->getBody(), PHP_EOL, PHP_EOL, PHP_EOL;
return $resp->getBody();
}
echo $e->getTraceAsString(), PHP_EOL;
return $e->getTraceAsString();
}
}