This commit is contained in:
wucongxing8150 2024-06-26 14:54:50 +08:00
parent 0fc0b46a04
commit e2847b5079

View File

@ -271,20 +271,21 @@ class WechatPay
$url = "v3/pay/transactions/out-trade-no/" . $out_trade_no . "/close";
$response = $app->getClient()->postJson($url, $options);
if ($response->isFailed()) {
// 出错了,处理异常
$result = $response->toArray(false);
Log::getInstance()->info(json_encode($result,JSON_UNESCAPED_UNICODE));
if(empty($result)){
// 返回值为空
throw new BusinessException("发起支付失败");
}
if (!empty($result['code'])){
if ($result['code'] != 400){
throw new BusinessException($result['message']);
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("关闭支付订单失败");
}
}else{
throw new BusinessException("关闭支付订单失败");
}
}