Skip to content

Commit

Permalink
renew docs refs 773eec6
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNorthMemory committed May 21, 2022
1 parent 3e15430 commit c5c207d
Showing 1 changed file with 4 additions and 34 deletions.
38 changes: 4 additions & 34 deletions README_APIv2.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,8 @@ $res = $instance
// 特殊接入点,仅对本次请求有效
'base_uri' => 'https://fraud.mch.weixin.qq.com/',
])
// 返回无sign字典,默认只能从异常通道获取返回值
->otherwise(static function($e) {
// 更多`$e`异常类型判断是必须的,这里仅列出可能的两种情况,请根据实际对接过程调整并增加
if ($e instanceof \GuzzleHttp\Promise\RejectionException) {
return Transformer::toArray((string)$e->getReason()->getBody());
}
if ($e instanceof \Psr\Http\Message\MessageInterface) {
return Transformer::toArray((string)$e->getBody());
}
return [];
->then(static function($response) {
return Transformer::toArray((string)$response->getBody());
})
->wait();
print_r($res);
Expand Down Expand Up @@ -147,13 +139,6 @@ $res = $instance
->then(static function($response) {
return Transformer::toArray((string)$response->getBody());
})
->otherwise(static function($e) {
// 更多`$e`异常类型判断是必须的,这里仅列出一种可能情况,请根据实际对接过程调整并增加
if ($e instanceof \GuzzleHttp\Promise\RejectionException) {
return Transformer::toArray((string)$e->getReason()->getBody());
}
return [];
})
->wait();
print_r($res);
```
Expand Down Expand Up @@ -186,13 +171,6 @@ $res = $instance
->then(static function($response) {
return Transformer::toArray((string)$response->getBody());
})
->otherwise(static function($e) {
// 更多`$e`异常类型判断是必须的,这里仅列出一种可能情况,请根据实际对接过程调整并增加
if ($e instanceof \GuzzleHttp\Promise\RejectionException) {
return Transformer::toArray((string)$e->getReason()->getBody());
}
return [];
})
->wait();
print_r($res);
```
Expand All @@ -212,16 +190,8 @@ $res = $instance
// 通知SDK不接受沙箱环境重定向,仅对本次请求有效
'allow_redirects' => false,
])
// 返回无sign字典,只能从异常通道获取返回值
->otherwise(static function($e) {
// 更多`$e`异常类型判断是必须的,这里仅列出可能的两种情况,请根据实际对接过程调整并增加
if ($e instanceof \GuzzleHttp\Promise\RejectionException) {
return Transformer::toArray((string)$e->getReason()->getBody());
}
if ($e instanceof \Psr\Http\Message\MessageInterface) {
return Transformer::toArray((string)$e->getBody());
}
return [];
->then(static function($response) {
return Transformer::toArray((string)$response->getBody());
})
->wait();
print_r($res);
Expand Down

0 comments on commit c5c207d

Please sign in to comment.