's'
This commit is contained in:
@@ -11,13 +11,15 @@ export async function GET(request: NextRequest) {
|
|||||||
return NextResponse.json({ ok: false, error: "未配置 PAYMENT_API_URL" }, { status: 500 });
|
return NextResponse.json({ ok: false, error: "未配置 PAYMENT_API_URL" }, { status: 500 });
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
const controller = new AbortController();
|
||||||
|
const timeout = setTimeout(() => controller.abort(), 25000);
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`${config.apiUrl}/zpay_order_status?out_trade_no=${encodeURIComponent(orderId)}`,
|
`${config.apiUrl}/zpay_order_status?out_trade_no=${encodeURIComponent(orderId)}`,
|
||||||
{ cache: "no-store" }
|
{ cache: "no-store", signal: controller.signal }
|
||||||
);
|
).finally(() => clearTimeout(timeout));
|
||||||
const data = await res.json().catch(() => ({}));
|
const data = await res.json().catch(() => ({}));
|
||||||
return NextResponse.json({ ok: true, paid: !!data?.paid });
|
return NextResponse.json({ ok: true, paid: !!data?.paid });
|
||||||
} catch (e) {
|
} catch {
|
||||||
return NextResponse.json({ ok: false, paid: false, error: String(e) }, { status: 500 });
|
return NextResponse.json({ ok: true, paid: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,5 +25,6 @@
|
|||||||
"eslint-config-next": "16.1.6",
|
"eslint-config-next": "16.1.6",
|
||||||
"tailwindcss": "^4",
|
"tailwindcss": "^4",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
}
|
},
|
||||||
|
"packageManager": "pnpm@10.25.0+sha1.2cfb3ab644446565c127f58165cc76368c9c920b"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import type { NextRequest } from "next/server";
|
|||||||
const LOCALES = ["zh", "en"];
|
const LOCALES = ["zh", "en"];
|
||||||
const DEFAULT_LOCALE = "zh";
|
const DEFAULT_LOCALE = "zh";
|
||||||
|
|
||||||
export function middleware(request: NextRequest) {
|
export function proxy(request: NextRequest) {
|
||||||
const { pathname } = request.nextUrl;
|
const { pathname } = request.nextUrl;
|
||||||
|
|
||||||
const hasLocale = LOCALES.some(
|
const hasLocale = LOCALES.some(
|
||||||
Reference in New Issue
Block a user