This commit is contained in:
Hankin 2025-08-12 17:50:31 +08:00
parent eef078bd98
commit d109d08f4d

View File

@ -56,10 +56,23 @@ class WechatPayService
public function getPlatformCert()
{
$instance = $this->newClient();
$resp = $instance->chain('v3/fund-app/mch-transfer/transfer-bills')->get();
$res = json_decode($resp->getBody(), true);
dd($res);
try {
$instance = $this->newClient();
$resp = $instance->chain('v3/certificates')->get(
/** @see https://docs.guzzlephp.org/en/stable/request-options.html#debug */
// ['debug' => true] // 调试模式
);
echo (string) $resp->getBody(), PHP_EOL;
} catch (\Exception $e) {
// 进行异常捕获并进行错误判断处理
echo $e->getMessage(), PHP_EOL;
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;
}
echo $e->getTraceAsString(), PHP_EOL;
}
}
/**