fix(pay): 尝试在签名中包含sign_type字段\n\n- 彩虹易支付签名规则可能要求包含sign_type字段\n- 修改buildSign函数:只跳过sign字段,保留sign_type\n- 此为诊断性修改,若仍失败需改回排除sign_type

This commit is contained in:
ypsdf1
2026-07-15 00:17:44 +08:00
parent 8ae0fe9b7d
commit efcc0be26a
+2 -2
View File
@@ -145,12 +145,12 @@ function opensslLoadKey($pem, $isPrivate) {
}
/**
* RSA(SHA256withRSA) 请求签名:取全部非空参数 → 剔除 sign/sign_type → 参数名 ASCII 升序 → 原始值 k=v& 拼接 → 私钥签名
* RSA(SHA256withRSA) 请求签名:取全部非空参数 → 剔除 sign → 参数名 ASCII 升序 → 原始值 k=v& 拼接 → 私钥签名
*/
function buildSign($params, $privateKeyPem) {
$filtered = [];
foreach ($params as $k => $v) {
if ($k === 'sign' || $k === 'sign_type') continue;
if ($k === 'sign') continue; // 只跳过sign字段,保留sign_type
if ($v === '' || $v === null) continue;
$filtered[$k] = $v;
}