'优化课程'

This commit is contained in:
eric
2026-03-11 22:26:12 -05:00
parent ade21e076f
commit 867d53936c
26 changed files with 2178 additions and 885 deletions

View File

@@ -11,13 +11,15 @@ export async function GET(request: NextRequest) {
return NextResponse.json({ ok: false, error: "未配置 PAYMENT_API_URL" }, { status: 500 });
}
try {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 25000);
const res = await fetch(
`${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(() => ({}));
return NextResponse.json({ ok: true, paid: !!data?.paid });
} catch (e) {
return NextResponse.json({ ok: false, paid: false, error: String(e) }, { status: 500 });
} catch {
return NextResponse.json({ ok: true, paid: false });
}
}