修复两个问题

This commit is contained in:
2026-08-24 16:38:03 +08:00
parent 48a82403b2
commit 58f3f42bf8
15 changed files with 173 additions and 23 deletions
+41
View File
@@ -56,6 +56,38 @@
});
}
function applyAssetBalances(data) {
data = data || {};
var wallet = data.wallet_balance !== undefined ? data.wallet_balance : data.wallet;
var points = data.credit_balance !== undefined ? data.credit_balance : data.points_balance;
if (wallet !== undefined && wallet !== null && wallet !== '') {
var walletNumber = Number(wallet);
var walletText = Number.isFinite(walletNumber) ? walletNumber.toFixed(2) : String(wallet);
document.querySelectorAll('[data-aksrt-wallet-value]').forEach(function (element) {
element.textContent = walletText;
});
}
if (points !== undefined && points !== null && points !== '') {
var pointsNumber = Number(points);
var pointsText = Number.isFinite(pointsNumber) ? pointsNumber.toLocaleString() : String(points);
document.querySelectorAll('[data-aksrt-points-value]').forEach(function (element) {
element.textContent = pointsText;
});
}
}
function refreshAssetBalances(snapshot) {
if (snapshot && (snapshot.wallet_balance !== undefined || snapshot.wallet !== undefined)) {
applyAssetBalances(snapshot);
}
return api('/pay/assets').then(function (response) {
if (!response.ok) return null;
var data = response.data || (response.json && response.json.data) || response.json || {};
applyAssetBalances(data);
return data;
});
}
// Task-list "去签到" → scroll + click the real asset-card sign-in button.
function initSigninGoto() {
document.querySelectorAll('[data-aksrt-signin-goto]').forEach(function (el) {
@@ -333,6 +365,7 @@
activePoll = null;
if (result.success) {
notyf('支付成功,正在刷新…', 'success', 5, 'aksrt-balance-charge-payment-toast');
refreshAssetBalances();
window.setTimeout(function () { window.location.reload(); }, 800);
return;
}
@@ -416,6 +449,7 @@
return;
}
notyf((data && data.message) || '充值成功,正在刷新…', 'success', 5, 'aksrt-balance-charge-toast');
refreshAssetBalances(data);
window.setTimeout(function () { window.location.reload(); }, 800);
}).catch(function () {
busy = false;
@@ -547,6 +581,7 @@
var data = (r.json && r.json.data) ? r.json.data : r.json;
resetOperationKey(form);
notyf((data && data.message) || '转账成功,正在刷新…', 'success', 5, 'aksrt-balance-transfer-toast');
refreshAssetBalances();
window.setTimeout(function () { window.location.reload(); }, 800);
}).catch(function () {
busy = false;
@@ -606,6 +641,7 @@
var data = (r.json && r.json.data) ? r.json.data : r.json;
resetOperationKey(form);
notyf((data && data.message) || '购买成功,正在刷新…', 'success', 5, 'aksrt-balance-points-toast');
refreshAssetBalances(data);
window.setTimeout(function () { window.location.reload(); }, 800);
}).catch(function () {
busy = false;
@@ -742,8 +778,13 @@
}
window.AKSRTWithdrawInit = initWithdraw;
window.AKSRTAssetBalances = {
apply: applyAssetBalances,
refresh: refreshAssetBalances
};
function bootAssets() {
refreshAssetBalances();
initSigninGoto();
initAffiliateRevenue();
initVipShop();