This commit is contained in:
Billy 2025-10-22 19:55:52 +08:00
parent a4945b8114
commit 2ecb1eca63

View File

@ -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);
// 只有非成功状态才抛出异常
if ($code !== 'CLD_SUCCESS') {
throw new \Exception('建行业务错误[' . $code . ']: ' . $desc);
}
// 检查 CLD_BODY 是否存在
if (!isset($data['CLD_BODY'])) {
throw new \Exception('响应数据结构错误缺少CLD_BODY');
}
}