更换金币图

This commit is contained in:
170-carry 2026-04-30 15:20:34 +08:00
parent 536d61d7b0
commit fe1a44afba
17 changed files with 159 additions and 66 deletions

View File

@ -26,7 +26,7 @@
--gold-650: #a84e16;
--line: rgba(255, 230, 173, 0.9);
--hero-image: url("../../assets/room-turnover-reward/hero.png");
--coin-image: url("../../assets/coin-lz3Tp0nX-1776148661447.png");
--coin-image: url("../../assets/coin-lz3Tp0nX-177614866144.png");
}
* {

View File

@ -572,7 +572,7 @@
<script>
const DEFAULT_AVATAR = "../../assets/defaultAvatar-CdxWBK1k.png";
const FALLBACK_IMAGE = "../../assets/coin-lz3Tp0nX-1776148661447.png";
const FALLBACK_IMAGE = "../../assets/coin-lz3Tp0nX-177614866144.png";
const DEFAULT_WEEK_STAR_API_BASE = "https://jvapi.haiyihy.com/";
const TOP_RANK_ICONS = {
1: "../../assets/yumi-week-star/rank-top1.png",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 884 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1 +1 @@
const s="/assets/coin-lz3Tp0nX-1776148661447.png";export{s as _};
const s="/assets/coin-lz3Tp0nX-177614866144.png";export{s as _};

View File

@ -1 +1 @@
const e=r=>{console.log("头像资源出错"),r.target.onerror=null,r.target.src=new URL("/assets/defaultAvatar-CdxWBK1k.png",import.meta.url).href},t=(r,a)=>{console.log("图片资源出错"),r.target.onerror=null,a=="GOLD"?r.target.src=new URL("/assets/coin-lz3Tp0nX-1776148661447.png",import.meta.url).href:a=="DOLLARS"&&(r.target.src=new URL("/assets/dollar-fhua8OJo-1776148661448.png",import.meta.url).href)};export{t as a,e as h};
const e=r=>{console.log("头像资源出错"),r.target.onerror=null,r.target.src=new URL("/assets/defaultAvatar-CdxWBK1k.png",import.meta.url).href},t=(r,a)=>{console.log("图片资源出错"),r.target.onerror=null,a=="GOLD"?r.target.src=new URL("/assets/coin-lz3Tp0nX-177614866144.png",import.meta.url).href:a=="DOLLARS"&&(r.target.src=new URL("/assets/dollar-fhua8OJo-1776148661448.png",import.meta.url).href)};export{t as a,e as h};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,20 @@
const query = new URLSearchParams(window.location.search);
const query = readURLParams();
const storedAppId = window.localStorage.getItem("mifa-pay-application-id") || "";
const API_BASE_URL = "https://jvapi.haiyihy.com";
const LOGO_SRC = "./mifapay-logo.png";
function readURLParams() {
const result = new URLSearchParams(window.location.search);
const hashQuery = window.location.hash.includes("?") ? window.location.hash.split("?")[1] : "";
const hashParams = new URLSearchParams(hashQuery);
hashParams.forEach((value, key) => {
if (!result.has(key)) {
result.set(key, value);
}
});
return result;
}
function getPathApplicationId() {
const segments = window.location.pathname.split("/").filter(Boolean);
const pageIndex = segments.lastIndexOf("mifa-pay");
@ -9,7 +22,8 @@ function getPathApplicationId() {
return "";
}
return segments[pageIndex + 1] || "";
const candidate = segments[pageIndex + 1] || "";
return /^\d+$/.test(candidate) ? candidate : "";
}
const defaults = {
@ -22,14 +36,6 @@ const defaults = {
productType: query.get("type") || "GOLD",
};
const deps = {
getApi: null,
postApi: null,
fetchCurrentUser: null,
getCachedUserProfile: null,
connectApp: null,
};
const state = {
applicationId: defaults.applicationId,
productType: defaults.productType,
@ -42,7 +48,6 @@ const state = {
selectedGoodsId: "",
selectedGoods: null,
pendingChannelCode: "",
dependencyPromise: null,
};
const els = {
@ -67,6 +72,133 @@ function persistSettings() {
window.localStorage.setItem("mifa-pay-application-id", state.applicationId);
}
function readRawParam(name) {
const queries = [window.location.search.replace(/^\?/, "")];
if (window.location.hash.includes("?")) {
queries.push(window.location.hash.split("?")[1]);
}
for (const item of queries) {
for (const part of item.split("&")) {
if (!part) {
continue;
}
const equalIndex = part.indexOf("=");
const rawKey = equalIndex >= 0 ? part.slice(0, equalIndex) : part;
const rawValue = equalIndex >= 0 ? part.slice(equalIndex + 1) : "";
let decodedKey = "";
try {
decodedKey = decodeURIComponent(rawKey);
} catch (error) {
continue;
}
if (decodedKey !== name) {
continue;
}
try {
return decodeURIComponent(rawValue.replace(/\+/g, "%2B"));
} catch (error) {
return rawValue;
}
}
}
return "";
}
function apiBaseURL() {
const override = window.MIFAPAY_API_BASE_URL || query.get("apiBase");
return String(override || API_BASE_URL).replace(/\/+$/, "");
}
function normalizeAuthorization(value) {
const token = String(value || "").trim();
if (!token) {
return "";
}
return /^bearer\s+/i.test(token) ? token : `Bearer ${token}`;
}
function currentToken() {
return (
readRawParam("token") ||
readRawParam("Authorization") ||
readRawParam("authorization") ||
readRawParam("accessToken")
);
}
function currentLanguage() {
return query.get("lang") || document.documentElement.lang || navigator.language || "en";
}
function authHeadersFromToken(token) {
return {
Accept: "application/json, text/plain, */*",
Authorization: normalizeAuthorization(token),
"req-lang": currentLanguage(),
"req-client": "H5",
"req-version": "V2",
"req-zone": Intl.DateTimeFormat().resolvedOptions().timeZone || "Asia/Shanghai",
"req-app-intel": "version=1.0.0;build=1;model=H5;sysVersion=Web;channel=Web",
"req-sys-origin": "origin=ATYOU;originChild=ATYOU",
};
}
function requestHeaders(hasBody = false) {
const token = currentToken();
if (!token) {
throw new Error("Missing token");
}
const headers = authHeadersFromToken(token);
if (hasBody) {
headers["Content-Type"] = "application/json";
}
return headers;
}
function buildRequestURL(path) {
const base = `${apiBaseURL()}/`;
const target = String(path || "").replace(/^\/+/, "");
return new URL(target, base).toString();
}
async function requestJSON(path, options = {}) {
const hasBody = options.body !== undefined;
const request = {
method: options.method || "GET",
cache: "no-store",
headers: requestHeaders(hasBody),
};
if (hasBody) {
request.body = JSON.stringify(options.body);
}
const response = await fetch(buildRequestURL(path), request);
const data = await response.json().catch(() => ({}));
if (!response.ok || data.status === false) {
const error = new Error(data.errorMsg || data.message || `Request failed: ${response.status}`);
error.response = data;
throw error;
}
return data;
}
function apiGet(path) {
return requestJSON(path);
}
function apiPost(path, body) {
return requestJSON(path, {
method: "POST",
body,
});
}
function extractErrorMessage(error) {
return (
error?.response?.errorMsg ||
@ -96,13 +228,6 @@ function resolveUserProfile(response = null) {
return response.body;
}
if (typeof deps.getCachedUserProfile === "function") {
const cached = deps.getCachedUserProfile();
if (cached && typeof cached === "object") {
return cached;
}
}
return readStoredUserProfile();
}
@ -278,42 +403,11 @@ function selectCountryByProfile() {
return true;
}
async function ensureDependencies() {
if (!state.dependencyPromise) {
state.dependencyPromise = Promise.all([
import("../js/index-CIAVq8iD-1776148658686.js"),
import("../js/appConnector-B5Pbaops-1776148658686.js"),
]).then(([indexModule, connectorModule]) => {
deps.getApi = indexModule.L;
deps.postApi = indexModule.W;
deps.fetchCurrentUser = indexModule.au;
deps.getCachedUserProfile = indexModule.at;
deps.connectApp = connectorModule.c;
return deps;
});
}
return state.dependencyPromise;
}
async function connectSession() {
await ensureDependencies();
const connection = await deps.connectApp();
if (!connection?.success) {
throw new Error(connection?.error || "Failed to initialize app session");
}
const cachedUserProfile = resolveUserProfile();
if (cachedUserProfile?.id) {
state.userProfile = cachedUserProfile;
return;
}
const response = await deps.fetchCurrentUser();
const response = await apiGet("/team/member/profile");
const userProfile = resolveUserProfile(response);
if (!userProfile?.id) {
throw new Error("Please open this page inside the app");
throw new Error("Account not available");
}
state.userProfile = userProfile;
@ -327,7 +421,7 @@ async function refreshMeta() {
persistSettings();
els.applicationId.value = state.applicationId;
const applicationResp = await deps.getApi(
const applicationResp = await apiGet(
`/order/web/pay/application/${encodeURIComponent(state.applicationId)}`
);
state.application = applicationResp?.body || {};
@ -344,7 +438,7 @@ async function refreshMeta() {
profileQuery.set("userId", currentUserId());
}
const profileResp = await deps.getApi(
const profileResp = await apiGet(
`/order/web/pay/user-profile?${profileQuery.toString()}`
);
const payProfile = profileResp?.body || {};
@ -374,7 +468,7 @@ async function refreshMeta() {
}
}
const commodityResp = await deps.getApi(
const commodityResp = await apiGet(
`/order/web/pay/commodity?applicationId=${encodeURIComponent(
state.applicationId
)}&payCountryId=${encodeURIComponent(currentCountryId())}&type=${encodeURIComponent(
@ -414,15 +508,15 @@ async function createOrder(channelCode) {
renderChannels();
const payload = {
applicationId: Number(state.applicationId),
goodsId: Number(state.selectedGoodsId),
payCountryId: Number(currentCountryId()),
userId: Number(currentUserId()),
applicationId: state.applicationId,
goodsId: state.selectedGoodsId,
payCountryId: currentCountryId(),
userId: currentUserId(),
channelCode,
newVersion: true,
};
const response = await deps.postApi("/order/web/pay/recharge", payload);
const response = await apiPost("/order/web/pay/recharge", payload);
const requestUrl = safeDecodeUrl(response?.body?.requestUrl || "");
if (!requestUrl) {
throw new Error("Missing payment url");
@ -432,7 +526,6 @@ async function createOrder(channelCode) {
}
async function reloadPageData() {
await ensureDependencies();
await connectSession();
await refreshMeta();
}