's'
This commit is contained in:
@@ -114,7 +114,7 @@ export async function POST(request: NextRequest) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const return_url = String(body?.return_url || "").trim();
|
const return_url = String(body?.return_url || "").trim();
|
||||||
const total_fee = Number(body?.total_fee) || payConfig.defaultAmount || 880;
|
const total_fee = Number(body?.total_fee) || payConfig.defaultAmount || 8800;
|
||||||
const type = String(body?.type || "vip");
|
const type = String(body?.type || "vip");
|
||||||
const channel = String(body?.channel || "wxpay");
|
const channel = String(body?.channel || "wxpay");
|
||||||
const device = String(body?.device || "pc");
|
const device = String(body?.device || "pc");
|
||||||
@@ -374,11 +374,11 @@ h2{color:#1e293b;margin:0 0 8px;font-size:1.5rem;}
|
|||||||
.then(function(r){return r.json();})
|
.then(function(r){return r.json();})
|
||||||
.then(function(d){
|
.then(function(d){
|
||||||
if(d.ok&&d.paid){showSuccess();return;}
|
if(d.ok&&d.paid){showSuccess();return;}
|
||||||
setTimeout(check,2000);
|
setTimeout(check,1000);
|
||||||
})
|
})
|
||||||
.catch(function(){setTimeout(check,2000);});
|
.catch(function(){setTimeout(check,1000);});
|
||||||
}
|
}
|
||||||
setTimeout(check,2000);
|
setTimeout(check,1000);
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</body></html>`;
|
</body></html>`;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
const COOKIE_NAME = "nomadvip_pay_order";
|
const COOKIE_NAME = "nomadvip_pay_order";
|
||||||
const POLL_INTERVAL = 2000;
|
const POLL_INTERVAL = 1000;
|
||||||
const MAX_POLLS = 160; // ~5 分钟
|
const MAX_POLLS = 160; // ~5 分钟
|
||||||
const MAX_AGE_MS = 15 * 60 * 1000;
|
const MAX_AGE_MS = 15 * 60 * 1000;
|
||||||
|
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ export default function Home() {
|
|||||||
const returnUrl = `${window.location.origin}/paid`;
|
const returnUrl = `${window.location.origin}/paid`;
|
||||||
const env = getPayEnv();
|
const env = getPayEnv();
|
||||||
const device = getDeviceFromEnv(env);
|
const device = getDeviceFromEnv(env);
|
||||||
const totalFee = getPaymentConfig().defaultAmount ?? 880;
|
const totalFee = getPaymentConfig().defaultAmount ?? 8800;
|
||||||
const base = { user_id: userId, return_url: returnUrl, total_fee: totalFee, type: "vip", channel: "wxpay" as const };
|
const base = { user_id: userId, return_url: returnUrl, total_fee: totalFee, type: "vip", channel: "wxpay" as const };
|
||||||
if (device === "wechat" && WECHAT_PAY_PROVIDER === "xorpay") {
|
if (device === "wechat" && WECHAT_PAY_PROVIDER === "xorpay") {
|
||||||
payWechatXorpay(base);
|
payWechatXorpay(base);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export interface PaymentConfig {
|
|||||||
apiUrl: string;
|
apiUrl: string;
|
||||||
provider: "zpay" | "xorpay";
|
provider: "zpay" | "xorpay";
|
||||||
zpaySubmitUrl: string;
|
zpaySubmitUrl: string;
|
||||||
/** 默认金额(分),8.8 元 = 880 */
|
/** 默认金额(分),88 元 = 8800 */
|
||||||
defaultAmount?: number;
|
defaultAmount?: number;
|
||||||
/** nomadvip 专用接口路径 */
|
/** nomadvip 专用接口路径 */
|
||||||
nomadvipPayPath: string;
|
nomadvipPayPath: string;
|
||||||
@@ -56,7 +56,7 @@ export function getPaymentConfig(): PaymentConfig {
|
|||||||
provider: (process.env.PAYMENT_PROVIDER as "zpay" | "xorpay") || "zpay",
|
provider: (process.env.PAYMENT_PROVIDER as "zpay" | "xorpay") || "zpay",
|
||||||
zpaySubmitUrl:
|
zpaySubmitUrl:
|
||||||
process.env.ZPAY_SUBMIT_URL || "https://zpayz.cn/submit.php",
|
process.env.ZPAY_SUBMIT_URL || "https://zpayz.cn/submit.php",
|
||||||
defaultAmount: 880,
|
defaultAmount: 8800,
|
||||||
nomadvipPayPath: "/nomadvip/payh5",
|
nomadvipPayPath: "/nomadvip/payh5",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user