From 0c344003001e02cc6462e2f09101b63ef453fd61 Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 10 Mar 2026 07:26:30 -0500 Subject: [PATCH] 's' --- app/api/pay/route.ts | 57 +------------------------------------------- 1 file changed, 1 insertion(+), 56 deletions(-) diff --git a/app/api/pay/route.ts b/app/api/pay/route.ts index 4a01579..d52a7db 100644 --- a/app/api/pay/route.ts +++ b/app/api/pay/route.ts @@ -178,65 +178,10 @@ export async function POST(request: NextRequest) { if (redirectRes.status >= 301 && redirectRes.status <= 308) { const location = redirectRes.headers.get("location"); if (location) { + const res = NextResponse.redirect(location); const orderId = redirectRes.headers.get("x-pay-order-id")?.trim() || String(params?.out_trade_no || "").trim(); - if (device === "h5") { - const returnUrl = finalReturnUrl.replace( - /[&<>"']/g, - (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c] || c - ); - const payUrl = location.replace( - /[&<>"']/g, - (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c] || c - ); - const isWx = ["wxpay", "wx", "wechat"].includes(channel.toLowerCase()); - const title = isWx ? "微信支付" : "支付宝支付"; - const hint = isWx - ? "点击下方按钮跳转至支付页面,支付完成后将自动返回" - : "点击下方按钮跳转至支付页面,支付完成后将自动返回"; - const esc = (s: string) => - s.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c] || c); - const html = ` - -${esc(title)} - - -

${esc(title)}

-

${esc(hint)}

-跳转支付 -

支付成功后将自动跳转,1 分钟内未支付将返回首页

- -`; - const res = new NextResponse(html, { - status: 200, - headers: { "Content-Type": "text/html; charset=utf-8" }, - }); - if (orderId) setPayOrderCookie(res, orderId); - return res; - } - const res = NextResponse.redirect(location); if (orderId) setPayOrderCookie(res, orderId); return res; }