refactor: rename the theme brand and every identifier from AKSRT to Jio
Full-project rename. `git grep -i aksrt` is now empty apart from the
DBMigrator 3.3.0 changelog note that documents the rename itself.
Code identifiers
- PHP namespace AKSRT\ -> Jio\ (composer PSR-4 + 378 declarations)
- global constants AKSRT_* -> JIO_* (VERSION/DIR/URI, PAY_TYPE_*, CAPTCHA_*)
- procedural functions, hooks, options, meta keys, table names,
cookies, query vars, ajax actions and nonces: aksrt_ -> jio_
- text domain aksrt -> jio; Theme Name -> Jio
- JS globals: aksrtData/aksrtAdminData/... -> jioData/jioAdminData/...,
window.AKSRTCaptcha & friends -> window.JioCaptcha, Aksrt* -> Jio*
- Vue components Aks*.vue -> Jio*.vue (15 files renamed + imports)
- CSS classes/data-attrs/custom properties: aksrt- -> jio-
- REST namespace aksrt/v1 -> jio/v1 (incl. payment gateway callbacks)
Storage layer
- DB tables {prefix}aksrt_* -> {prefix}jio_*; SCHEMA_VERSION 3.2.0 -> 3.3.0
so dbDelta creates the new names on install
- widget id_base aksrt_widget_* -> jio_widget_*
- uninstall.php drop list rebuilt from the actual migrator tables
(dropped 3 stale entries, added the 17 missing ones)
Removed
- hardcoded https://api.aksrt.com/version.json default update endpoint;
get_endpoint() now reads the 「更新端点」 setting and do_check() no-ops
when it is empty
Files renamed: inc/helpers/aksrt-*.php -> jio-*.php (54),
assets/admin/src/components/form/Aks*.vue -> Jio*.vue (15).
Build artifacts regenerated: assets/css/build, assets/js/runtime,
assets/admin/build.
Verified: audit-psr4-paths errors=0, audit-admin-contracts errors=0
(warnings=56, unchanged baseline), 813/813 widget-system tests,
44/44 phpunit, php -l clean across all PHP.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
5b16bc6e15
commit
35bb96e82f
997 files changed
+28216
-28188
No files matched your search
+123
-123
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* AKSRT Credits Frontend
|
||||
* Jio Credits Frontend
|
||||
*
|
||||
* 功能:
|
||||
* - 签到 panel:跳转至全局签到按钮
|
||||
@@ -10,8 +10,8 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var aksrt = window.aksrtData;
|
||||
if (!aksrt) {
|
||||
var jio = window.jioData;
|
||||
if (!jio) {
|
||||
return;
|
||||
}
|
||||
var activePoll = null;
|
||||
@@ -19,18 +19,18 @@
|
||||
// 自定义货币名称(后台「积分配置 → 自定义货币名称」)由服务端注入。
|
||||
// 转账标题/金额标签与购买提示都在客户端拼装,必须跟随它。
|
||||
function currencyName() {
|
||||
return (aksrt && aksrt.currencyName) || '积分';
|
||||
return (jio && jio.currencyName) || '积分';
|
||||
}
|
||||
|
||||
function operationKey(owner) {
|
||||
if (!owner.dataset.aksrtOperationKey) {
|
||||
owner.dataset.aksrtOperationKey = window.AksrtRequest.createIdempotencyKey();
|
||||
if (!owner.dataset.jioOperationKey) {
|
||||
owner.dataset.jioOperationKey = window.JioRequest.createIdempotencyKey();
|
||||
}
|
||||
return owner.dataset.aksrtOperationKey;
|
||||
return owner.dataset.jioOperationKey;
|
||||
}
|
||||
|
||||
function resetOperationKey(owner) {
|
||||
delete owner.dataset.aksrtOperationKey;
|
||||
delete owner.dataset.jioOperationKey;
|
||||
}
|
||||
|
||||
function resetOperationKeyOnChange(owner) {
|
||||
@@ -53,7 +53,7 @@
|
||||
}
|
||||
|
||||
function api(path, options) {
|
||||
return window.AksrtRequest.request(path, options || {}).then(function (response) {
|
||||
return window.JioRequest.request(path, options || {}).then(function (response) {
|
||||
return {
|
||||
ok: response.ok,
|
||||
status: response.status,
|
||||
@@ -77,8 +77,8 @@
|
||||
if (wallet !== undefined && wallet !== null && wallet !== '') {
|
||||
var walletNumber = Number(wallet);
|
||||
var walletText = Number.isFinite(walletNumber) ? walletNumber.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : String(wallet);
|
||||
document.querySelectorAll('[data-aksrt-wallet-value]').forEach(function (element) {
|
||||
var text = element.dataset.aksrtCountFormat === 'cut-count' ? formatCutCount(wallet) : walletText;
|
||||
document.querySelectorAll('[data-jio-wallet-value]').forEach(function (element) {
|
||||
var text = element.dataset.jioCountFormat === 'cut-count' ? formatCutCount(wallet) : walletText;
|
||||
element.textContent = text;
|
||||
element.title = text;
|
||||
});
|
||||
@@ -86,8 +86,8 @@
|
||||
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) {
|
||||
var text = element.dataset.aksrtCountFormat === 'cut-count' ? formatCutCount(points) : pointsText;
|
||||
document.querySelectorAll('[data-jio-points-value]').forEach(function (element) {
|
||||
var text = element.dataset.jioCountFormat === 'cut-count' ? formatCutCount(points) : pointsText;
|
||||
element.textContent = text;
|
||||
element.title = text;
|
||||
});
|
||||
@@ -108,12 +108,12 @@
|
||||
|
||||
// Task-list "去签到" → scroll + click the real asset-card sign-in button.
|
||||
function initSigninGoto() {
|
||||
document.querySelectorAll('[data-aksrt-signin-goto]').forEach(function (el) {
|
||||
if (el.dataset.aksrtSigninGotoInitialized === '1') return;
|
||||
el.dataset.aksrtSigninGotoInitialized = '1';
|
||||
document.querySelectorAll('[data-jio-signin-goto]').forEach(function (el) {
|
||||
if (el.dataset.jioSigninGotoInitialized === '1') return;
|
||||
el.dataset.jioSigninGotoInitialized = '1';
|
||||
el.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
var root = document.querySelector('[data-aksrt-signin]');
|
||||
var root = document.querySelector('[data-jio-signin]');
|
||||
var btn = root ? root.querySelector('[data-signin-btn]') : null;
|
||||
if (!btn) return;
|
||||
try {
|
||||
@@ -133,11 +133,11 @@
|
||||
|
||||
// ===== VIP 开通 =====
|
||||
function initVipShop() {
|
||||
var root = document.querySelector('[data-aksrt-vip-shop]');
|
||||
var root = document.querySelector('[data-jio-vip-shop]');
|
||||
if (!root) return;
|
||||
var tip = root.querySelector('[data-aksrt-vip-tip]');
|
||||
var tip = root.querySelector('[data-jio-vip-tip]');
|
||||
var busy = false;
|
||||
var coordinator = window.AksrtVipPurchaseCoordinator;
|
||||
var coordinator = window.JioVipPurchaseCoordinator;
|
||||
|
||||
function setTip(text, isError) {
|
||||
if (!tip) return;
|
||||
@@ -146,16 +146,16 @@
|
||||
}
|
||||
|
||||
function selectedMethod() {
|
||||
var fixed = root.querySelector('[data-aksrt-vip-method-fixed]');
|
||||
var fixed = root.querySelector('[data-jio-vip-method-fixed]');
|
||||
if (fixed && fixed.value) return fixed.value;
|
||||
var checked = root.querySelector('input[name="aksrt_vip_pay_method"]:checked');
|
||||
var checked = root.querySelector('input[name="jio_vip_pay_method"]:checked');
|
||||
if (checked) return checked.value;
|
||||
var first = root.querySelector('input[name="aksrt_vip_pay_method"]');
|
||||
var first = root.querySelector('input[name="jio_vip_pay_method"]');
|
||||
return first ? first.value : 'balance';
|
||||
}
|
||||
|
||||
root.addEventListener('click', function (e) {
|
||||
var btn = e.target.closest('[data-aksrt-vip-buy]');
|
||||
var btn = e.target.closest('[data-jio-vip-buy]');
|
||||
if (!btn || busy) return;
|
||||
e.preventDefault();
|
||||
var packageId = parseInt(btn.getAttribute('data-package-id') || '0', 10);
|
||||
@@ -173,7 +173,7 @@
|
||||
busy = false;
|
||||
btn.disabled = false;
|
||||
btn.classList.remove('is-loading');
|
||||
if (window.AksrtPayCashier) window.AksrtPayCashier.handle(data, {});
|
||||
if (window.JioPayCashier) window.JioPayCashier.handle(data, {});
|
||||
setTip(data.message || '请完成支付,支付成功后将自动刷新。');
|
||||
},
|
||||
onSuccess: function (result) {
|
||||
@@ -219,8 +219,8 @@
|
||||
}
|
||||
var data = (r.json && r.json.data) ? r.json.data : r.json;
|
||||
resetOperationKey(keyOwner);
|
||||
if (type === 'vip' && window.AksrtModalRuntime && typeof window.AksrtModalRuntime.invalidate === 'function') {
|
||||
window.AksrtModalRuntime.invalidate(['vip', 'orders']);
|
||||
if (type === 'vip' && window.JioModalRuntime && typeof window.JioModalRuntime.invalidate === 'function') {
|
||||
window.JioModalRuntime.invalidate(['vip', 'orders']);
|
||||
}
|
||||
notyf((data && data.message) || '兑换成功,正在刷新…', 'success', 5, toastId);
|
||||
window.setTimeout(function () { window.location.reload(); }, 800);
|
||||
@@ -241,7 +241,7 @@
|
||||
if (!el) return;
|
||||
if (activePoll && typeof activePoll.abort === 'function') {
|
||||
activePoll.abort();
|
||||
notyf('已停止查询支付状态', 'warning', 3, 'aksrt-balance-charge-payment-toast');
|
||||
notyf('已停止查询支付状态', 'warning', 3, 'jio-balance-charge-payment-toast');
|
||||
}
|
||||
activePoll = null;
|
||||
el.hidden = true;
|
||||
@@ -251,36 +251,36 @@
|
||||
}
|
||||
}
|
||||
function pollPaidOrder(orderNumber, tags) {
|
||||
var coordinator = window.AksrtVipPurchaseCoordinator;
|
||||
var coordinator = window.JioVipPurchaseCoordinator;
|
||||
if (!orderNumber) return;
|
||||
notyf('等待支付结果…', 'load', '', 'aksrt-balance-charge-payment-toast');
|
||||
notyf('等待支付结果…', 'load', '', 'jio-balance-charge-payment-toast');
|
||||
var handle = coordinator.poll(orderNumber, {
|
||||
tags: tags || ['credits', 'orders'],
|
||||
onTerminal: function (result) {
|
||||
activePoll = null;
|
||||
if (window.AksrtPayCashier) window.AksrtPayCashier.close();
|
||||
if (window.JioPayCashier) window.JioPayCashier.close();
|
||||
if (result.success) {
|
||||
notyf('支付成功,正在刷新…', 'success', 5, 'aksrt-balance-charge-payment-toast');
|
||||
notyf('支付成功,正在刷新…', 'success', 5, 'jio-balance-charge-payment-toast');
|
||||
refreshAssetBalances();
|
||||
window.setTimeout(function () { window.location.reload(); }, 800);
|
||||
return;
|
||||
}
|
||||
var message = result.data && result.data.message ? result.data.message : '支付未完成,请重试';
|
||||
notyf(message, 'danger', 5, 'aksrt-balance-charge-payment-toast');
|
||||
notyf(message, 'danger', 5, 'jio-balance-charge-payment-toast');
|
||||
},
|
||||
onTimeout: function () {
|
||||
activePoll = null;
|
||||
notyf('支付状态暂未确认,请稍后在订单中心查看', 'danger', 5, 'aksrt-balance-charge-payment-toast');
|
||||
notyf('支付状态暂未确认,请稍后在订单中心查看', 'danger', 5, 'jio-balance-charge-payment-toast');
|
||||
}
|
||||
});
|
||||
return handle;
|
||||
}
|
||||
|
||||
function initBalanceCharge() {
|
||||
var modal = document.querySelector('[data-aksrt-charge-modal]');
|
||||
if (!modal || modal.dataset.aksrtChargeInitialized === '1') return;
|
||||
modal.dataset.aksrtChargeInitialized = '1';
|
||||
var form = modal.querySelector('[data-aksrt-charge-form]');
|
||||
var modal = document.querySelector('[data-jio-charge-modal]');
|
||||
if (!modal || modal.dataset.jioChargeInitialized === '1') return;
|
||||
modal.dataset.jioChargeInitialized = '1';
|
||||
var form = modal.querySelector('[data-jio-charge-form]');
|
||||
var busy = false;
|
||||
var chargeBackdrop = null;
|
||||
|
||||
@@ -298,7 +298,7 @@
|
||||
if (!chargeBackdrop) {
|
||||
chargeBackdrop = document.createElement('div');
|
||||
chargeBackdrop.className = 'modal-backdrop fade in';
|
||||
chargeBackdrop.setAttribute('data-aksrt-charge-backdrop', '1');
|
||||
chargeBackdrop.setAttribute('data-jio-charge-backdrop', '1');
|
||||
document.body.appendChild(chargeBackdrop);
|
||||
}
|
||||
document.body.classList.add('modal-open');
|
||||
@@ -307,7 +307,7 @@
|
||||
if (!modal.classList.contains('in')) return;
|
||||
if (activePoll && typeof activePoll.abort === 'function') {
|
||||
activePoll.abort();
|
||||
notyf('已停止查询支付状态', 'warning', 3, 'aksrt-balance-charge-payment-toast');
|
||||
notyf('已停止查询支付状态', 'warning', 3, 'jio-balance-charge-payment-toast');
|
||||
}
|
||||
activePoll = null;
|
||||
modal.classList.remove('in');
|
||||
@@ -323,7 +323,7 @@
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
document.querySelectorAll('[data-aksrt-charge-open]').forEach(function (btn) {
|
||||
document.querySelectorAll('[data-jio-charge-open]').forEach(function (btn) {
|
||||
btn.addEventListener('click', openChargeModal);
|
||||
});
|
||||
modal.addEventListener('click', function (e) {
|
||||
@@ -412,11 +412,11 @@
|
||||
return;
|
||||
}
|
||||
busy = true;
|
||||
notyf('正在兑换…', 'load', '', 'aksrt-balance-charge-toast');
|
||||
redeemCardPass('balance', cardEl ? String(cardEl.value || '').trim() : '', password, form, 'aksrt-balance-charge-toast')
|
||||
notyf('正在兑换…', 'load', '', 'jio-balance-charge-toast');
|
||||
redeemCardPass('balance', cardEl ? String(cardEl.value || '').trim() : '', password, form, 'jio-balance-charge-toast')
|
||||
.then(function (result) {
|
||||
busy = false;
|
||||
if (!result.ok) notyf(result.message, 'danger', 5, 'aksrt-balance-charge-toast');
|
||||
if (!result.ok) notyf(result.message, 'danger', 5, 'jio-balance-charge-toast');
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -434,7 +434,7 @@
|
||||
return;
|
||||
}
|
||||
busy = true;
|
||||
notyf('正在创建充值订单…', 'load', '', 'aksrt-balance-charge-toast');
|
||||
notyf('正在创建充值订单…', 'load', '', 'jio-balance-charge-toast');
|
||||
api('/pay/balance/charge', {
|
||||
method: 'POST',
|
||||
headers: { 'Idempotency-Key': operationKey(form) },
|
||||
@@ -448,61 +448,61 @@
|
||||
}).then(function (r) {
|
||||
busy = false;
|
||||
if (!r.ok || (r.json && r.json.code && !r.json.success)) {
|
||||
notyf((r.json && r.json.message) || '充值失败', 'danger', 5, 'aksrt-balance-charge-toast');
|
||||
notyf((r.json && r.json.message) || '充值失败', 'danger', 5, 'jio-balance-charge-toast');
|
||||
return;
|
||||
}
|
||||
var data = (r.json && r.json.data) ? r.json.data : r.json;
|
||||
resetOperationKey(form);
|
||||
if (data && data.mode) {
|
||||
if (window.AksrtModalRuntime) window.AksrtModalRuntime.invalidate(['orders']);
|
||||
if (window.AksrtPayCashier) {
|
||||
window.AksrtPayCashier.handle(data, {
|
||||
if (window.JioModalRuntime) window.JioModalRuntime.invalidate(['orders']);
|
||||
if (window.JioPayCashier) {
|
||||
window.JioPayCashier.handle(data, {
|
||||
onClose: function () {
|
||||
if (activePoll && typeof activePoll.abort === 'function') activePoll.abort();
|
||||
activePoll = null;
|
||||
notyf('已停止查询支付状态', 'warning', 3, 'aksrt-balance-charge-payment-toast');
|
||||
notyf('已停止查询支付状态', 'warning', 3, 'jio-balance-charge-payment-toast');
|
||||
}
|
||||
});
|
||||
}
|
||||
notyf(data.message || '请完成支付,支付成功后将自动刷新。', 'info', 5, 'aksrt-balance-charge-toast');
|
||||
notyf(data.message || '请完成支付,支付成功后将自动刷新。', 'info', 5, 'jio-balance-charge-toast');
|
||||
if (data.order_number) activePoll = pollPaidOrder(data.order_number, ['credits', 'orders']);
|
||||
return;
|
||||
}
|
||||
notyf((data && data.message) || '充值成功,正在刷新…', 'success', 5, 'aksrt-balance-charge-toast');
|
||||
notyf((data && data.message) || '充值成功,正在刷新…', 'success', 5, 'jio-balance-charge-toast');
|
||||
refreshAssetBalances(data);
|
||||
window.setTimeout(function () { window.location.reload(); }, 800);
|
||||
}).catch(function () {
|
||||
busy = false;
|
||||
notyf('网络错误,请重试', 'danger', 5, 'aksrt-balance-charge-toast');
|
||||
notyf('网络错误,请重试', 'danger', 5, 'jio-balance-charge-toast');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function initTransfer() {
|
||||
var modal = document.querySelector('[data-aksrt-transfer-modal]');
|
||||
if (!modal || modal.dataset.aksrtTransferInitialized === '1') return;
|
||||
modal.dataset.aksrtTransferInitialized = '1';
|
||||
var form = modal.querySelector('[data-aksrt-transfer-form]');
|
||||
var results = modal.querySelector('[data-aksrt-transfer-results]');
|
||||
var selected = modal.querySelector('[data-aksrt-transfer-selected]');
|
||||
var recipientInput = modal.querySelector('[data-aksrt-transfer-recipient]');
|
||||
var typeInput = modal.querySelector('[data-aksrt-transfer-type]');
|
||||
var title = modal.querySelector('[data-aksrt-transfer-title]');
|
||||
var amountLabel = modal.querySelector('[data-aksrt-transfer-amount-label]');
|
||||
var balanceInfo = modal.querySelector('[data-aksrt-transfer-balance-info]');
|
||||
var pointsInfo = modal.querySelector('[data-aksrt-transfer-points-info]');
|
||||
var modal = document.querySelector('[data-jio-transfer-modal]');
|
||||
if (!modal || modal.dataset.jioTransferInitialized === '1') return;
|
||||
modal.dataset.jioTransferInitialized = '1';
|
||||
var form = modal.querySelector('[data-jio-transfer-form]');
|
||||
var results = modal.querySelector('[data-jio-transfer-results]');
|
||||
var selected = modal.querySelector('[data-jio-transfer-selected]');
|
||||
var recipientInput = modal.querySelector('[data-jio-transfer-recipient]');
|
||||
var typeInput = modal.querySelector('[data-jio-transfer-type]');
|
||||
var title = modal.querySelector('[data-jio-transfer-title]');
|
||||
var amountLabel = modal.querySelector('[data-jio-transfer-amount-label]');
|
||||
var balanceInfo = modal.querySelector('[data-jio-transfer-balance-info]');
|
||||
var pointsInfo = modal.querySelector('[data-jio-transfer-points-info]');
|
||||
var pointsTransferMin = 1;
|
||||
var searchTimer = null;
|
||||
var busy = false;
|
||||
document.querySelectorAll('[data-aksrt-transfer-open]').forEach(function (btn) {
|
||||
document.querySelectorAll('[data-jio-transfer-open]').forEach(function (btn) {
|
||||
btn.addEventListener('click', function () {
|
||||
var type = btn.getAttribute('data-aksrt-transfer-open') || 'balance';
|
||||
var type = btn.getAttribute('data-jio-transfer-open') || 'balance';
|
||||
pointsTransferMin = type === 'points'
|
||||
? Math.max(1, parseInt(btn.getAttribute('data-aksrt-transfer-min') || '1', 10) || 1)
|
||||
? Math.max(1, parseInt(btn.getAttribute('data-jio-transfer-min') || '1', 10) || 1)
|
||||
: 1;
|
||||
if (typeInput) typeInput.value = type;
|
||||
if (title) title.textContent = type === 'points' ? currencyName() + '转账' : '余额转账';
|
||||
var amountEl = form ? form.querySelector('[data-aksrt-transfer-amount]') : null;
|
||||
var amountEl = form ? form.querySelector('[data-jio-transfer-amount]') : null;
|
||||
if (amountEl) {
|
||||
amountEl.min = type === 'points' ? String(pointsTransferMin) : '0.01';
|
||||
amountEl.step = type === 'points' ? '1' : '0.01';
|
||||
@@ -518,10 +518,10 @@
|
||||
openModal(modal);
|
||||
});
|
||||
});
|
||||
modal.querySelectorAll('[data-aksrt-transfer-close]').forEach(function (btn) {
|
||||
modal.querySelectorAll('[data-jio-transfer-close]').forEach(function (btn) {
|
||||
btn.addEventListener('click', function () { closeModal(modal); });
|
||||
});
|
||||
var searchEl = modal.querySelector('[data-aksrt-transfer-search]');
|
||||
var searchEl = modal.querySelector('[data-jio-transfer-search]');
|
||||
if (searchEl) {
|
||||
searchEl.addEventListener('input', function () {
|
||||
var q = String(searchEl.value || '').trim();
|
||||
@@ -578,7 +578,7 @@
|
||||
if (busy) return;
|
||||
var type = typeInput ? typeInput.value : 'balance';
|
||||
var recipient = recipientInput ? parseInt(recipientInput.value || '0', 10) : 0;
|
||||
var amountEl = form.querySelector('[data-aksrt-transfer-amount]');
|
||||
var amountEl = form.querySelector('[data-jio-transfer-amount]');
|
||||
var amount = amountEl ? amountEl.value : 0;
|
||||
if (!recipient) {
|
||||
notyf('请选择收款用户', 'danger');
|
||||
@@ -594,7 +594,7 @@
|
||||
return;
|
||||
}
|
||||
busy = true;
|
||||
notyf('正在转账…', 'load', '', 'aksrt-balance-transfer-toast');
|
||||
notyf('正在转账…', 'load', '', 'jio-balance-transfer-toast');
|
||||
api('/pay/transfer', {
|
||||
method: 'POST',
|
||||
headers: { 'Idempotency-Key': operationKey(form) },
|
||||
@@ -606,27 +606,27 @@
|
||||
}).then(function (r) {
|
||||
busy = false;
|
||||
if (!r.ok || (r.json && r.json.code && !r.json.success)) {
|
||||
notyf((r.json && r.json.message) || '转账失败', 'danger', 5, 'aksrt-balance-transfer-toast');
|
||||
notyf((r.json && r.json.message) || '转账失败', 'danger', 5, 'jio-balance-transfer-toast');
|
||||
return;
|
||||
}
|
||||
var data = (r.json && r.json.data) ? r.json.data : r.json;
|
||||
resetOperationKey(form);
|
||||
notyf((data && data.message) || '转账成功,正在刷新…', 'success', 5, 'aksrt-balance-transfer-toast');
|
||||
notyf((data && data.message) || '转账成功,正在刷新…', 'success', 5, 'jio-balance-transfer-toast');
|
||||
refreshAssetBalances();
|
||||
window.setTimeout(function () { window.location.reload(); }, 800);
|
||||
}).catch(function () {
|
||||
busy = false;
|
||||
notyf('网络错误,请重试', 'danger', 5, 'aksrt-balance-transfer-toast');
|
||||
notyf('网络错误,请重试', 'danger', 5, 'jio-balance-transfer-toast');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ===== 购买积分(Zibll points-pay modal 1:1:商品/自定义 + 余额/卡密支付) =====
|
||||
function initPointsPay() {
|
||||
var modal = document.querySelector('[data-aksrt-points-pay-modal]');
|
||||
if (!modal || modal.dataset.aksrtPointsPayInitialized === '1') return;
|
||||
modal.dataset.aksrtPointsPayInitialized = '1';
|
||||
var form = modal.querySelector('[data-aksrt-points-pay-form]');
|
||||
var modal = document.querySelector('[data-jio-points-pay-modal]');
|
||||
if (!modal || modal.dataset.jioPointsPayInitialized === '1') return;
|
||||
modal.dataset.jioPointsPayInitialized = '1';
|
||||
var form = modal.querySelector('[data-jio-points-pay-form]');
|
||||
var busy = false;
|
||||
var backdrop = null;
|
||||
|
||||
@@ -638,7 +638,7 @@
|
||||
if (!backdrop) {
|
||||
backdrop = document.createElement('div');
|
||||
backdrop.className = 'modal-backdrop fade in';
|
||||
backdrop.setAttribute('data-aksrt-points-backdrop', '1');
|
||||
backdrop.setAttribute('data-jio-points-backdrop', '1');
|
||||
document.body.appendChild(backdrop);
|
||||
}
|
||||
document.body.classList.add('modal-open');
|
||||
@@ -653,7 +653,7 @@
|
||||
if (!modal.classList.contains('in')) modal.style.display = '';
|
||||
}, 300);
|
||||
}
|
||||
document.querySelectorAll('[data-aksrt-points-pay-open]').forEach(function (btn) {
|
||||
document.querySelectorAll('[data-jio-points-pay-open]').forEach(function (btn) {
|
||||
btn.addEventListener('click', openPointsModal);
|
||||
});
|
||||
modal.addEventListener('click', function (e) {
|
||||
@@ -732,11 +732,11 @@
|
||||
return;
|
||||
}
|
||||
busy = true;
|
||||
notyf('正在兑换…', 'load', '', 'aksrt-balance-points-toast');
|
||||
redeemCardPass('credits', cardEl ? String(cardEl.value || '').trim() : '', password, form, 'aksrt-balance-points-toast')
|
||||
notyf('正在兑换…', 'load', '', 'jio-balance-points-toast');
|
||||
redeemCardPass('credits', cardEl ? String(cardEl.value || '').trim() : '', password, form, 'jio-balance-points-toast')
|
||||
.then(function (result) {
|
||||
busy = false;
|
||||
if (!result.ok) notyf(result.message, 'danger', 5, 'aksrt-balance-points-toast');
|
||||
if (!result.ok) notyf(result.message, 'danger', 5, 'jio-balance-points-toast');
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -754,7 +754,7 @@
|
||||
return;
|
||||
}
|
||||
busy = true;
|
||||
notyf('正在购买' + currencyName() + '…', 'load', '', 'aksrt-balance-points-toast');
|
||||
notyf('正在购买' + currencyName() + '…', 'load', '', 'jio-balance-points-toast');
|
||||
api('/pay/balance/points-exchange', {
|
||||
method: 'POST',
|
||||
headers: { 'Idempotency-Key': operationKey(form) },
|
||||
@@ -762,35 +762,35 @@
|
||||
}).then(function (r) {
|
||||
busy = false;
|
||||
if (!r.ok || (r.json && r.json.code && !r.json.success)) {
|
||||
notyf((r.json && r.json.message) || '购买失败', 'danger', 5, 'aksrt-balance-points-toast');
|
||||
notyf((r.json && r.json.message) || '购买失败', 'danger', 5, 'jio-balance-points-toast');
|
||||
return;
|
||||
}
|
||||
var data = (r.json && r.json.data) ? r.json.data : r.json;
|
||||
resetOperationKey(form);
|
||||
notyf((data && data.message) || '购买成功,正在刷新…', 'success', 5, 'aksrt-balance-points-toast');
|
||||
notyf((data && data.message) || '购买成功,正在刷新…', 'success', 5, 'jio-balance-points-toast');
|
||||
refreshAssetBalances(data);
|
||||
window.setTimeout(function () { window.location.reload(); }, 800);
|
||||
}).catch(function () {
|
||||
busy = false;
|
||||
notyf('网络错误,请重试', 'danger', 5, 'aksrt-balance-points-toast');
|
||||
notyf('网络错误,请重试', 'danger', 5, 'jio-balance-points-toast');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function initWithdraw() {
|
||||
var modal = document.querySelector('[data-aksrt-withdraw-modal]');
|
||||
if (!modal || modal.dataset.aksrtWithdrawInitialized === '1') return;
|
||||
modal.dataset.aksrtWithdrawInitialized = '1';
|
||||
var form = modal.querySelector('[data-aksrt-withdraw-form]');
|
||||
var modal = document.querySelector('[data-jio-withdraw-modal]');
|
||||
if (!modal || modal.dataset.jioWithdrawInitialized === '1') return;
|
||||
modal.dataset.jioWithdrawInitialized = '1';
|
||||
var form = modal.querySelector('[data-jio-withdraw-form]');
|
||||
var busy = false;
|
||||
// 提现来源随打开按钮传入:commission 走佣金池,其余走余额钱包。
|
||||
// 每个来源的每日次数/额度不同,按钮上带了各自的 min/remaining,
|
||||
// 打开时覆盖到金额输入框,提交时把 source 一并回传。
|
||||
document.querySelectorAll('[data-aksrt-withdraw-open]').forEach(function (btn) {
|
||||
document.querySelectorAll('[data-jio-withdraw-open]').forEach(function (btn) {
|
||||
btn.addEventListener('click', function () {
|
||||
var src = btn.getAttribute('data-aksrt-withdraw-source') || 'balance';
|
||||
modal.dataset.aksrtWithdrawSource = src === 'commission' ? 'commission' : 'balance';
|
||||
var amountEl = form ? form.querySelector('[data-aksrt-withdraw-amount]') : null;
|
||||
var src = btn.getAttribute('data-jio-withdraw-source') || 'balance';
|
||||
modal.dataset.jioWithdrawSource = src === 'commission' ? 'commission' : 'balance';
|
||||
var amountEl = form ? form.querySelector('[data-jio-withdraw-amount]') : null;
|
||||
if (amountEl) {
|
||||
var min = btn.getAttribute('data-withdraw-min');
|
||||
var remAmt = btn.getAttribute('data-withdraw-remaining-amount');
|
||||
@@ -802,7 +802,7 @@
|
||||
openModal(modal);
|
||||
});
|
||||
});
|
||||
modal.querySelectorAll('[data-aksrt-withdraw-close]').forEach(function (btn) {
|
||||
modal.querySelectorAll('[data-jio-withdraw-close]').forEach(function (btn) {
|
||||
btn.addEventListener('click', function () { closeModal(modal); });
|
||||
});
|
||||
if (!form) return;
|
||||
@@ -810,9 +810,9 @@
|
||||
form.addEventListener('submit', function (e) {
|
||||
e.preventDefault();
|
||||
if (busy) return;
|
||||
var amountEl = form.querySelector('[data-aksrt-withdraw-amount]');
|
||||
var methodEl = form.querySelector('[data-aksrt-withdraw-method]');
|
||||
var accountEl = form.querySelector('[data-aksrt-withdraw-account]');
|
||||
var amountEl = form.querySelector('[data-jio-withdraw-amount]');
|
||||
var methodEl = form.querySelector('[data-jio-withdraw-method]');
|
||||
var accountEl = form.querySelector('[data-jio-withdraw-account]');
|
||||
var rawAmount = amountEl ? String(amountEl.value || '').trim() : '';
|
||||
var amount = rawAmount;
|
||||
var amountMinor = balanceMinor(amount);
|
||||
@@ -842,8 +842,8 @@
|
||||
return;
|
||||
}
|
||||
busy = true;
|
||||
notyf('正在提交提现申请…', 'load', '', 'aksrt-balance-withdraw-toast');
|
||||
var source = modal.dataset.aksrtWithdrawSource === 'commission' ? 'commission' : 'balance';
|
||||
notyf('正在提交提现申请…', 'load', '', 'jio-balance-withdraw-toast');
|
||||
var source = modal.dataset.jioWithdrawSource === 'commission' ? 'commission' : 'balance';
|
||||
api('/earnings/withdrawals', {
|
||||
method: 'POST',
|
||||
headers: { 'Idempotency-Key': operationKey(form) },
|
||||
@@ -851,21 +851,21 @@
|
||||
}).then(function (r) {
|
||||
busy = false;
|
||||
if (!r.ok || (r.json && r.json.code && !r.json.success)) {
|
||||
notyf((r.json && r.json.message) || '提现失败', 'danger', 5, 'aksrt-balance-withdraw-toast');
|
||||
notyf((r.json && r.json.message) || '提现失败', 'danger', 5, 'jio-balance-withdraw-toast');
|
||||
return;
|
||||
}
|
||||
var data = (r.json && r.json.data) ? r.json.data : r.json;
|
||||
resetOperationKey(form);
|
||||
var successMessage = (data && data.message) || '申请已提交';
|
||||
if (data && data.withdrawal_number) successMessage += '(' + data.withdrawal_number + ')';
|
||||
notyf(successMessage, 'success', 5, 'aksrt-balance-withdraw-toast');
|
||||
notyf(successMessage, 'success', 5, 'jio-balance-withdraw-toast');
|
||||
closeModal(modal);
|
||||
// 佣金提现刷新推广收益面板,余额提现刷新余额面板;各自拉取对应片段。
|
||||
var panelName = source === 'commission' ? 'revenue' : 'credits';
|
||||
var panel = document.getElementById('panel-' + panelName) || (modal.closest ? modal.closest('.dashboard-panel') : null);
|
||||
var rest = (window.aksrtData && (window.aksrtData.restUrl || window.aksrtData.apiUrl)) || (window.aksrtUserCenter && window.aksrtUserCenter.restUrl) || '';
|
||||
var rest = (window.jioData && (window.jioData.restUrl || window.jioData.apiUrl)) || (window.jioUserCenter && window.jioUserCenter.restUrl) || '';
|
||||
if (panel && rest) {
|
||||
fetch(rest.replace(/\/$/, '') + '/user-center/panel/' + panelName, { credentials: 'same-origin', headers: { 'X-WP-Nonce': (window.aksrtData && (window.aksrtData.restNonce || window.aksrtData.nonce)) || '' } })
|
||||
fetch(rest.replace(/\/$/, '') + '/user-center/panel/' + panelName, { credentials: 'same-origin', headers: { 'X-WP-Nonce': (window.jioData && (window.jioData.restNonce || window.jioData.nonce)) || '' } })
|
||||
.then(function (response) { return response.json(); })
|
||||
.then(function (payload) {
|
||||
if (!payload || !payload.success || !payload.data || typeof payload.data.html !== 'string') return;
|
||||
@@ -876,24 +876,24 @@
|
||||
}
|
||||
}).catch(function () {
|
||||
busy = false;
|
||||
notyf('网络错误,请重试', 'danger', 5, 'aksrt-balance-withdraw-toast');
|
||||
notyf('网络错误,请重试', 'danger', 5, 'jio-balance-withdraw-toast');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function initAssetTabs() {
|
||||
if (document.documentElement.dataset.aksrtAssetTabsBound === 'true') return;
|
||||
document.documentElement.dataset.aksrtAssetTabsBound = 'true';
|
||||
if (document.documentElement.dataset.jioAssetTabsBound === 'true') return;
|
||||
document.documentElement.dataset.jioAssetTabsBound = 'true';
|
||||
|
||||
function select(key) {
|
||||
document.querySelectorAll('.uc-asset-tabs__nav [data-aksrt-asset-tab]').forEach(function (link) {
|
||||
document.querySelectorAll('.uc-asset-tabs__nav [data-jio-asset-tab]').forEach(function (link) {
|
||||
var li = link.closest('li');
|
||||
if (!li) return;
|
||||
var linkKey = link.getAttribute('data-aksrt-asset-tab');
|
||||
var linkKey = link.getAttribute('data-jio-asset-tab');
|
||||
li.classList.toggle('active', linkKey === key || (key === 'points_date' && linkKey === 'points_free'));
|
||||
});
|
||||
document.querySelectorAll('[data-aksrt-asset-pane]').forEach(function (pane) {
|
||||
var active = pane.getAttribute('data-aksrt-asset-pane') === key;
|
||||
document.querySelectorAll('[data-jio-asset-pane]').forEach(function (pane) {
|
||||
var active = pane.getAttribute('data-jio-asset-pane') === key;
|
||||
pane.classList.toggle('is-active', active);
|
||||
pane.hidden = !active;
|
||||
});
|
||||
@@ -901,13 +901,13 @@
|
||||
|
||||
function loadPage(key, page) {
|
||||
var panel = document.querySelector('#panel-credits');
|
||||
var rest = (window.aksrtData && (window.aksrtData.restUrl || window.aksrtData.apiUrl)) || '';
|
||||
var rest = (window.jioData && (window.jioData.restUrl || window.jioData.apiUrl)) || '';
|
||||
if (!panel || !rest) return;
|
||||
panel.classList.add('is-loading');
|
||||
var url = rest.replace(/\/$/, '') + '/user-center/panel/credits?asset=' + encodeURIComponent(key) + '&page=' + encodeURIComponent(page);
|
||||
fetch(url, {
|
||||
credentials: 'same-origin',
|
||||
headers: { 'X-WP-Nonce': (window.aksrtData && (window.aksrtData.restNonce || window.aksrtData.nonce)) || '' }
|
||||
headers: { 'X-WP-Nonce': (window.jioData && (window.jioData.restNonce || window.jioData.nonce)) || '' }
|
||||
}).then(function (response) {
|
||||
return response.json().then(function (payload) {
|
||||
if (!response.ok || !payload || !payload.success || !payload.data || typeof payload.data.html !== 'string') throw new Error('asset-page-load-failed');
|
||||
@@ -924,23 +924,23 @@
|
||||
}
|
||||
|
||||
document.addEventListener('click', function (e) {
|
||||
var pageButton = e.target.closest('[data-aksrt-asset-page]');
|
||||
var pageButton = e.target.closest('[data-jio-asset-page]');
|
||||
if (pageButton) {
|
||||
e.preventDefault();
|
||||
loadPage(pageButton.getAttribute('data-aksrt-asset-key') || 'points', parseInt(pageButton.getAttribute('data-aksrt-asset-page') || '1', 10) || 1);
|
||||
loadPage(pageButton.getAttribute('data-jio-asset-key') || 'points', parseInt(pageButton.getAttribute('data-jio-asset-page') || '1', 10) || 1);
|
||||
return;
|
||||
}
|
||||
var link = e.target.closest('[data-aksrt-asset-tab]');
|
||||
var link = e.target.closest('[data-jio-asset-tab]');
|
||||
if (!link) return;
|
||||
e.preventDefault();
|
||||
select(link.getAttribute('data-aksrt-asset-tab'));
|
||||
select(link.getAttribute('data-jio-asset-tab'));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
window.AKSRTWithdrawInit = initWithdraw;
|
||||
window.AKSRTAssetBalances = {
|
||||
window.JioWithdrawInit = initWithdraw;
|
||||
window.JioAssetBalances = {
|
||||
apply: applyAssetBalances,
|
||||
refresh: refreshAssetBalances
|
||||
};
|
||||
@@ -956,7 +956,7 @@
|
||||
initAssetTabs();
|
||||
}
|
||||
|
||||
jQuery(document).off('auto_fun.aksrt-credits').on('auto_fun.aksrt-credits', function () {
|
||||
jQuery(document).off('auto_fun.jio-credits').on('auto_fun.jio-credits', function () {
|
||||
bootAssets();
|
||||
});
|
||||
})();
|
||||
Reference in new issue
Block a user