From 2ecb1eca6375719661921d17f4086bbf67d97b07 Mon Sep 17 00:00:00 2001 From: Billy <641833868@qq.com> Date: Wed, 22 Oct 2025 19:55:52 +0800 Subject: [PATCH] up --- .../shopro/library/ccblife/CcbHttpClient.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/addons/shopro/library/ccblife/CcbHttpClient.php b/addons/shopro/library/ccblife/CcbHttpClient.php index ff8793b..412f660 100644 --- a/addons/shopro/library/ccblife/CcbHttpClient.php +++ b/addons/shopro/library/ccblife/CcbHttpClient.php @@ -242,7 +242,7 @@ class CcbHttpClient } // 检查业务响应码 -// $this->checkBusinessResponse($decryptedData); + $this->checkBusinessResponse($decryptedData); return $decryptedData; } @@ -260,18 +260,16 @@ class CcbHttpClient throw new \Exception('响应数据结构错误:缺少CLD_HEADER'); } - // 优先检查 CLD_HEADER.CLD_TX_RESP(建行新版错误响应) + // 检查 CLD_HEADER.CLD_TX_RESP(建行标准响应格式) if (isset($data['CLD_HEADER']['CLD_TX_RESP'])) { $txResp = $data['CLD_HEADER']['CLD_TX_RESP']; - $errorCode = isset($txResp['CLD_CODE']) ? $txResp['CLD_CODE'] : 'UNKNOWN'; - $errorDesc = isset($txResp['CLD_DESC']) ? $txResp['CLD_DESC'] : '未知错误'; + $code = isset($txResp['CLD_CODE']) ? $txResp['CLD_CODE'] : 'UNKNOWN'; + $desc = isset($txResp['CLD_DESC']) ? $txResp['CLD_DESC'] : '未知错误'; - throw new \Exception('建行业务错误[' . $errorCode . ']: ' . $errorDesc); - } - - // 检查 CLD_BODY 是否存在 - if (!isset($data['CLD_BODY'])) { - throw new \Exception('响应数据结构错误:缺少CLD_BODY'); + // 只有非成功状态才抛出异常 + if ($code !== 'CLD_SUCCESS') { + throw new \Exception('建行业务错误[' . $code . ']: ' . $desc); + } } }