feat(user-center): add cash wallet balance separate from credits

Introduce AKSRT_Balance (user_meta aksrt_balance + balance_log) for
Zibll-like pay_balance wallet. User center assets panel shows wallet
and points; balance gateway/card-pass/refunds credit cash when enabled.
This commit is contained in:
kate522 committed 2026-07-16 13:44:37 +08:00
1 parent f043d2c1ab
commit 8e0f9d989d
16 files changed
+637 -74

No files matched your search

+22 -2
View File
@@ -92,8 +92,16 @@ class AKSRT_User_Center {
$this->panels = [];
foreach ((array) ($settings['tabs'] ?? []) as $key) {
if ($key === 'credits' && (!class_exists('AKSRT_Settings') || !AKSRT_Settings::credits_enabled())) {
continue;
if ($key === 'credits') {
$credits_on = class_exists('AKSRT_Settings') && AKSRT_Settings::credits_enabled();
$balance_on = class_exists('AKSRT_Balance') && AKSRT_Balance::enabled();
if (!$credits_on && !$balance_on) {
continue;
}
if ($balance_on) {
$definitions['credits']['label'] = __('我的资产', 'aksrt');
$definitions['credits']['icon'] = 'wallet';
}
}
if (isset($definitions[$key])) {
@@ -101,6 +109,18 @@ class AKSRT_User_Center {
}
}
// Ensure assets panel when wallet and/or credits enabled (even if tabs list omitted credits).
$credits_on = class_exists('AKSRT_Settings') && AKSRT_Settings::credits_enabled();
$balance_on = class_exists('AKSRT_Balance') && AKSRT_Balance::enabled();
if (!isset($this->panels['credits']) && ($credits_on || $balance_on)) {
$panel = $definitions['credits'];
if ($balance_on) {
$panel['label'] = __('我的资产', 'aksrt');
$panel['icon'] = 'wallet';
}
$this->panels['credits'] = $panel;
}
if (!isset($this->panels['settings'])) {
$this->panels['settings'] = $definitions['settings'];
}