本地测试

This commit is contained in:
170-carry 2026-04-30 18:59:44 +08:00
parent 617684677d
commit bb0a31f601
2 changed files with 15 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

After

Width:  |  Height:  |  Size: 2.5 MiB

View File

@ -1,6 +1,7 @@
const query = readURLParams();
const storedAppId = window.localStorage.getItem("mifa-pay-application-id") || "";
const API_BASE_URL = "https://jvapi.haiyihy.com";
const LOCAL_API_BASE_URL = "http://127.0.0.1:1100";
const LOGO_SRC = "./mifapay-logo.png";
function readURLParams() {
@ -106,6 +107,20 @@ function readRawParam(name) {
}
function apiBaseURL() {
const useProdApi = query.get("prod") === "true";
const isLocalPage =
window.location.protocol === "http:" &&
["localhost", "127.0.0.1", "0.0.0.0", "::1", "[::1]"].includes(
window.location.hostname
);
if (isLocalPage && !useProdApi) {
return LOCAL_API_BASE_URL;
}
if (useProdApi) {
return API_BASE_URL;
}
const override = window.MIFAPAY_API_BASE_URL || query.get("apiBase");
return String(override || API_BASE_URL).replace(/\/+$/, "");
}