diff --git a/extend/Wechat/WechatPay.php b/extend/Wechat/WechatPay.php index 89c8723..176d614 100644 --- a/extend/Wechat/WechatPay.php +++ b/extend/Wechat/WechatPay.php @@ -254,11 +254,10 @@ class WechatPay /** * 关闭订单 * @param string $out_trade_no 商户系统内部订单号 - * @return array * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function closeOrder(string $out_trade_no): array + public function closeOrder(string $out_trade_no): void { $app = $this->createApp(); @@ -270,27 +269,8 @@ class WechatPay try { $url = "v3/pay/transactions/out-trade-no/" . $out_trade_no . "/close"; - $response = $app->getClient()->postJson($url, $options); - if (!empty($response)){ - if ($response->isFailed()) { - // 出错了,处理异常 - $result = $response->toArray(false); - if(empty($result)){ - // 返回值为空 - throw new BusinessException("关闭支付订单失败"); - } - if (!empty($result['code'])){ - if ($result['code'] != 400){ - throw new BusinessException($result['message']); - } - }else{ - throw new BusinessException("关闭支付订单失败"); - } - } - } - - return $response->toArray(false); - } catch (\Exception $e) { + $app->getClient()->postJson($url, $options); + } catch (\Throwable $e) { throw new BusinessException($e->getMessage(), HttpEnumCode::SERVER_ERROR); } }