's'
This commit is contained in:
@@ -104,7 +104,15 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
const payConfig = getPaymentConfig();
|
||||
const apiUrl = payConfig.apiUrl.replace(/\/$/, "");
|
||||
const user_id = String(body?.user_id || "").trim();
|
||||
let user_id = String(body?.user_id || "").trim();
|
||||
if (user_id.startsWith("{") && user_id.includes("data")) {
|
||||
try {
|
||||
const parsed = JSON.parse(user_id) as { data?: string };
|
||||
if (parsed?.data) user_id = String(parsed.data).trim();
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
const return_url = String(body?.return_url || "").trim();
|
||||
const total_fee = Number(body?.total_fee) || 180;
|
||||
const type = String(body?.type || "vip");
|
||||
|
||||
11
app/page.tsx
11
app/page.tsx
@@ -84,6 +84,17 @@ export default function Home() {
|
||||
|
||||
const getOrCreateUserId = useCallback(() => {
|
||||
let userId = getStorage("userId");
|
||||
if (userId?.startsWith("{") && userId.includes("data")) {
|
||||
try {
|
||||
const parsed = JSON.parse(userId) as { data?: string };
|
||||
if (parsed?.data) {
|
||||
userId = parsed.data;
|
||||
setStorage("userId", userId);
|
||||
}
|
||||
} catch {
|
||||
userId = null;
|
||||
}
|
||||
}
|
||||
if (!userId) {
|
||||
userId = `user${Date.now()}`;
|
||||
setStorage("userId", userId);
|
||||
|
||||
Reference in New Issue
Block a user