test
This commit is contained in:
parent
eef078bd98
commit
d109d08f4d
@ -56,10 +56,23 @@ class WechatPayService
|
|||||||
|
|
||||||
public function getPlatformCert()
|
public function getPlatformCert()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$instance = $this->newClient();
|
$instance = $this->newClient();
|
||||||
$resp = $instance->chain('v3/fund-app/mch-transfer/transfer-bills')->get();
|
$resp = $instance->chain('v3/certificates')->get(
|
||||||
$res = json_decode($resp->getBody(), true);
|
/** @see https://docs.guzzlephp.org/en/stable/request-options.html#debug */
|
||||||
dd($res);
|
// ['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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user