fix: 修复支付宝签名时错误排除 sign_type 导致 invalid-signature

支付宝验签字符串包含 sign_type 字段,但 generateSign 错误地
将 sign_type 与 sign 一起排除。只需排除 sign,保留 sign_type。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
erio
2026-03-06 16:14:52 +08:00
parent 0763d72a89
commit ad6b63dd9e
3 changed files with 10 additions and 10 deletions

View File

@@ -51,7 +51,7 @@ export function pageExecute(
params.sign = generateSign(params, env.ALIPAY_PRIVATE_KEY);
const query = new URLSearchParams({ ...params, sign_type: 'RSA2' }).toString();
const query = new URLSearchParams(params).toString();
return `${GATEWAY}?${query}`;
}
@@ -72,7 +72,6 @@ export async function execute<T extends AlipayResponse>(
};
params.sign = generateSign(params, env.ALIPAY_PRIVATE_KEY);
params.sign_type = 'RSA2';
const response = await fetch(GATEWAY, {
method: 'POST',