This commit is contained in:
eric
2026-03-31 13:40:42 -05:00
parent 0211d4c76b
commit fbde8dbcea
2 changed files with 16 additions and 31 deletions

View File

@@ -72,6 +72,7 @@ function setAnonymousUserCookie(
async function createPayOrder(
apiUrl: string,
user_id: string,
wechat_userid: string | undefined,
return_url: string,
total_fee: number,
type: string,
@@ -81,6 +82,7 @@ async function createPayOrder(
) {
const payload: Record<string, unknown> = {
user_id,
...(wechat_userid ? { wechat_userid } : {}),
site_id: "vip",
total_fee,
type,
@@ -141,6 +143,7 @@ export async function POST(request: NextRequest) {
).replace(/\/$/, "");
console.log("[pay] 立即加入 apiUrl=%s host=%s", apiUrl, hostHeader);
let user_id = String(body?.user_id || "").trim();
const wechat_userid = String(body?.wechat_userid || body?.userid || "").trim();
if (user_id.startsWith("{") && user_id.includes("data")) {
try {
const parsed = JSON.parse(user_id) as { data?: string };
@@ -187,6 +190,7 @@ export async function POST(request: NextRequest) {
if (effectiveProvider === "zpay") {
const redirectPayload = {
user_id,
...(wechat_userid ? { wechat_userid } : {}),
site_id: "vip",
total_fee,
type,
@@ -429,6 +433,7 @@ h2{color:#1e293b;margin:0 0 8px;font-size:1.5rem;}
const { params, payUrl, provider } = await createPayOrder(
apiUrl,
user_id,
wechat_userid || undefined,
finalReturnUrl,
total_fee,
type,