签名修复

This commit is contained in:
Billy 2025-10-27 19:03:30 +08:00
parent 278bc2ab03
commit 25814edcff
2 changed files with 15 additions and 19 deletions

View File

@ -123,10 +123,6 @@ class Ccbpayment extends Common
}
// 5. 生成支付串步骤3调用收银台
// ⚠️ 注意: generatePaymentString()内部已经完成了以下操作:
// - 更新订单的ccb_pay_flow_id字段幂等操作重复更新不影响
// - 记录支付日志到ccb_payment_log表
// 控制器不应该重复操作,否则会导致数据重复写入!
$result = $this->paymentService->generatePaymentString($orderId, $payFlowId);
if (!$result['status']) {

View File

@ -122,22 +122,11 @@ class CcbPaymentService
$macParams['REFERER'] = ''; // 商户URL空字符串
// ⚠️ 关键修复INSTALLNUM必须在THIRDAPPINFO之前严格按照文档4.1表格顺序)
// 1.3 可选参数按文档表格顺序有值才参与MAC
// 注意根据文档4.2橙色字段有值时才参与MAC空值不参与
// 分期期数在REFERER之后THIRDAPPINFO之前
if (!empty($this->config['install_num'])) {
$macParams['INSTALLNUM'] = $this->config['install_num'];
}
// ✅ 修复严格按照文档4.1表格顺序添加必填字段
// THIRDAPPINFO必须在INSTALLNUM之前第17位基础字段
$macParams['THIRDAPPINFO'] = 'comccbpay1234567890cloudmerchant'; // 客户端标识(固定值)
// 记录关键参数
Log::info('[建行支付] 关键参数 order_id:' . $orderId . ' pay_flow_id:' . $payFlowId . ' user_orderid:' . $order['order_sn'] . ' payment:' . $payment);
Log::info('[建行支付] 商户信息 merchant_id:' . ($macParams['MERCHANTID'] ?? 'N/A') . ' pos_id:' . ($macParams['POSID'] ?? 'N/A') . ' branch_id:' . ($macParams['BRANCHID'] ?? 'N/A'));
// 超时时间
// 超时时间第18位基础字段必填
if (!empty($this->config['timeout'])) {
$macParams['TIMEOUT'] = $this->config['timeout'];
} else {
@ -145,6 +134,18 @@ class CcbPaymentService
$macParams['TIMEOUT'] = date('YmdHis', strtotime('+30 minutes'));
}
// 记录关键参数
Log::info('[建行支付] 关键参数 order_id:' . $orderId . ' pay_flow_id:' . $payFlowId . ' user_orderid:' . $order['order_sn'] . ' payment:' . $payment);
Log::info('[建行支付] 商户信息 merchant_id:' . ($macParams['MERCHANTID'] ?? 'N/A') . ' pos_id:' . ($macParams['POSID'] ?? 'N/A') . ' branch_id:' . ($macParams['BRANCHID'] ?? 'N/A'));
// ========== ✅ 以下为可选参数第19+位),按文档表格顺序添加 ==========
// 注意根据文档4.2橙色字段有值时才参与MAC空值不参与
// 分期期数第19位可选参数
if (!empty($this->config['install_num'])) {
$macParams['INSTALLNUM'] = $this->config['install_num'];
}
// 中国建设银行App环境参数
// if (!empty($this->config['user_id'])) {
// $macParams['USERID'] = $this->config['user_id'];
@ -329,7 +330,6 @@ class CcbPaymentService
'message' => '支付串生成成功',
'data' => [
'payment_string' => $finalPaymentString,
// 'payment_string' => 'MERCHANTID=105003953998037&POSID=068295530&BRANCHID=340650000&ORDERID=PAY20251027163247893442&USER_ORDERID=202504324734011387001000&PAYMENT=2999.00&CURCODE=01&TXCODE=520100&REMARK1=&REMARK2=YS44000009001853&TYPE=1&GATEWAY=0&CLIENTIP=&REGINFO=&PROINFO=Apple%u0020Watch%u0020Series%u00207%u0020%u667A%u80FD%u624B%u8868GPS%u6B3E41%u0020%u6BEB%u7C73%u661F%u5149%u8272%u94DD%u91D1%u5C5E%u8868%u58F3%u661F%u5149%u8272%u8FD0%u52A8%u578B%u8868%u5E26&REFERER=&THIRDAPPINFO=comccbpay1234567890cloudmerchant&TIMEOUT=20251027172350&PLATFORMPUB=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC6yZj5rUHz+plEbTMSxF6iRy5XTd82LpKGkcRtJcNiHXAvOh/QvW6xc+GJSfvfM9pnRCyWkFrvFViOGnLUrjyoB0wa/TEqWootEEKXSDacFyQ/QIJSK0+zMYTC2Md6gGA4YylJQuYZ1lWDoOLBt9pP93Qnm0R2PEQ5a11HxwdvlQIDAQAB',
'mac' => $mac,
'order_sn' => $order['order_sn'],
'pay_flow_id' => $payFlowId,