diff --git a/assets/js/credits.js b/assets/js/credits.js
index 1b848a40..0ef6c28b 100644
--- a/assets/js/credits.js
+++ b/assets/js/credits.js
@@ -416,6 +416,8 @@
});
}
+ window.AKSRTAffiliatePromotionInit = initAffiliatePromotion;
+
// ===== VIP 积分兑换 =====
diff --git a/assets/js/revenue-invite.js b/assets/js/revenue-invite.js
index daf851ce..4a48f1e0 100644
--- a/assets/js/revenue-invite.js
+++ b/assets/js/revenue-invite.js
@@ -144,7 +144,7 @@
function reloadRevenuePanel() {
var current = document.querySelector('[data-aksrt-revenue-page]');
if (!current) return Promise.resolve();
- var panelUrl = rest + '/user-center/panel/revenue';
+ var panelUrl = rest + '/user-center/panel/promotion';
var query = new URL(window.location.href).searchParams;
query.delete('tab');
panelUrl += '?' + query.toString();
@@ -171,7 +171,7 @@
link.addEventListener('click', function (event) {
event.preventDefault();
var targetUrl = new URL(link.href, window.location.href);
- var panelUrl = rest + '/user-center/panel/revenue?' + targetUrl.searchParams.toString();
+ var panelUrl = rest + '/user-center/panel/promotion?' + targetUrl.searchParams.toString();
fetch(panelUrl, {
credentials: 'same-origin',
headers: { 'X-WP-Nonce': data.restNonce || data.nonce || '' }
@@ -187,6 +187,7 @@
current.replaceWith(next);
window.history.pushState({}, '', targetUrl);
window.AKSRTRevenueCenterInit(next);
+ if (typeof window.AKSRTAffiliatePromotionInit === 'function') window.AKSRTAffiliatePromotionInit();
if (typeof window.AKSRTWithdrawInit === 'function') window.AKSRTWithdrawInit();
});
}).catch(function () {
diff --git a/assets/js/routes/user-center.js b/assets/js/routes/user-center.js
index 5b97001e..d192e4a6 100644
--- a/assets/js/routes/user-center.js
+++ b/assets/js/routes/user-center.js
@@ -82,10 +82,10 @@
}
target.classList.add('is-loading');
var url = restUrl.replace(/\/$/, '') + '/user-center/panel/' + encodeURIComponent(name);
- if (name === 'creator' || name === 'revenue' || name === 'posts' || name === 'follow') {
+ if (name === 'creator' || name === 'promotion' || name === 'posts' || name === 'follow') {
var params = queryParams || new URLSearchParams(window.location.search);
var allowedParams = name === 'creator' ? ['income_page'] :
- (name === 'revenue' ? ['reward_tab', 'commission_page', 'invite_page'] :
+ (name === 'promotion' ? ['reward_tab', 'commission_page', 'invite_page'] :
(name === 'posts' ? ['post_status', 'posts_page'] : ['follow_list', 'follow_page']));
allowedParams.forEach(function(key) {
if (params.get(key)) url += (url.indexOf('?') === -1 ? '?' : '&') + key + '=' + encodeURIComponent(params.get(key));
@@ -120,7 +120,8 @@
return loadPanel(name, forceLoad, queryParams).then(function() {
switchTo(name);
if (updateHistory) updateUrl(name);
- if (typeof window.AKSRTRevenueCenterInit === 'function') window.AKSRTRevenueCenterInit(panels[name].panel);
+ if (name === 'promotion' && typeof window.AKSRTRevenueCenterInit === 'function') window.AKSRTRevenueCenterInit(panels[name].panel);
+ if (name === 'promotion' && typeof window.AKSRTAffiliatePromotionInit === 'function') window.AKSRTAffiliatePromotionInit();
}).catch(function() {
if (typeof showToast === 'function') showToast(i18n.networkError || '加载失败,请重试');
});
diff --git a/inc/helpers/aksrt-user-center.php b/inc/helpers/aksrt-user-center.php
index d4379a6f..643a2c21 100644
--- a/inc/helpers/aksrt-user-center.php
+++ b/inc/helpers/aksrt-user-center.php
@@ -135,6 +135,8 @@ if (!function_exists('aksrt_get_user_center_tab_url')) {
$tab = sanitize_key($tab);
if ('invite' === $tab) {
$tab = 'promotion';
+ } elseif ('revenue' === $tab) {
+ $tab = 'promotion';
}
return aksrt_get_user_center_url($tab);
}
@@ -181,7 +183,6 @@ if (!function_exists('aksrt_capture_user_center_view')) {
'orders' => 'orders',
'auth' => 'auth',
'promotion' => 'promotion',
- 'revenue' => 'revenue',
'settings' => 'settings',
'header' => 'header',
'sidebar' => 'sidebar',
@@ -206,7 +207,7 @@ if (!function_exists('aksrt_capture_user_center_panel')) {
* Capture a built-in or registered user-center panel body.
*/
function aksrt_capture_user_center_panel(string $tab_key, array $tab, array $context): string {
- $built_in_tabs = ['profile', 'level', 'creator', 'posts', 'follow', 'comments', 'favorites', 'credits', 'vip', 'orders', 'auth', 'promotion', 'revenue', 'settings'];
+ $built_in_tabs = ['profile', 'level', 'creator', 'posts', 'follow', 'comments', 'favorites', 'credits', 'vip', 'orders', 'auth', 'promotion', 'settings'];
if (in_array($tab_key, $built_in_tabs, true)) {
return aksrt_capture_user_center_view($tab_key, $context);
}
@@ -317,6 +318,8 @@ if (!function_exists('aksrt_user_center_resolve_tabs')) {
$active = 'credits';
} elseif ('invite' === $active) {
$active = 'promotion';
+ } elseif ('revenue' === $active) {
+ $active = 'promotion';
} elseif ('vip' === $active) {
// Prefer dedicated vip tab when registered; else credits (VIP shop).
$active = in_array('vip', $keys, true) ? 'vip' : 'credits';
@@ -356,6 +359,7 @@ if (!function_exists('aksrt_user_center_runtime_config')) {
'tabAliases' => [
'signin' => 'credits',
'invite' => 'promotion',
+ 'revenue' => 'promotion',
'assets' => 'credits',
// vip → vip when panel exists; SPA may still map missing keys via server resolve.
'vip' => 'vip',
@@ -507,11 +511,7 @@ if (!function_exists('aksrt_get_user_center_render_context')) {
$wallet_balance = (float) ($dashboard['wallet_balance'] ?? 0.0);
$runtime_config = aksrt_user_center_runtime_config($user_id, $tabs['default'], $active_tab, $tabs['urls']);
$runtime_config['avatarUpload'] = aksrt_user_center_avatar_upload_config($allow_avatar_upload);
- $revenue_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_payment_revenue_settings() : [];
- $show_revenue_section = !empty($revenue_settings['enabled']) || !empty($affiliate_settings['enabled']);
- $revenue_url = isset($tabs['tabs']['revenue'])
- ? aksrt_get_user_center_tab_url('revenue')
- : '';
+
$render_context = [
'user_center_settings' => $user_center_settings,
@@ -535,7 +535,6 @@ if (!function_exists('aksrt_get_user_center_render_context')) {
'show_avatar_edit' => $allow_avatar_upload,
'notification_unread_count' => function_exists('aksrt_get_user_unread_notification_count') ? aksrt_get_user_unread_notification_count($user_id) : 0,
'messages_url' => $messages_enabled && function_exists('aksrt_get_messages_page_url') ? aksrt_get_messages_page_url() : '',
- 'revenue_url' => $revenue_url,
'per_page' => 10,
'posts_page' => max(1, isset($_GET['posts_page']) ? (int) $_GET['posts_page'] : 1),
'post_status_filter' => $post_status_filter,
@@ -550,7 +549,6 @@ if (!function_exists('aksrt_get_user_center_render_context')) {
'show_vip' => !empty($vip_settings['enabled']),
'show_credit_tabs' => $show_credit_tabs,
'affiliate_enabled' => $show_credit_tabs && !empty($affiliate_settings['enabled']),
- 'show_revenue_section' => $show_revenue_section,
'currency_name' => $currency_name,
'credit_balance' => (float) ($dashboard['credit_balance'] ?? 0.0),
'credits_enabled' => $show_credit_tabs,
diff --git a/inc/helpers/user-center-renderers/profile-promotion.php b/inc/helpers/user-center-renderers/profile-promotion.php
index 14342f66..170074f1 100644
--- a/inc/helpers/user-center-renderers/profile-promotion.php
+++ b/inc/helpers/user-center-renderers/profile-promotion.php
@@ -1,27 +1,14 @@
' . esc_html__('请先登录', 'aksrt') . '';
- return;
-}
-
-$settings = class_exists('\\AKSRT\\Settings\\Settings') ? \AKSRT\Settings\Settings::get_affiliate_settings() : [];
-?>
-