feat(users): add inline promotion center

This commit is contained in:
kate522 committed 2026-08-03 13:40:54 +08:00
1 parent aa958c7d01
commit d138c05f77
11 files changed
+76 -88

No files matched your search

+9 -4
View File
@@ -102,13 +102,17 @@ if (!function_exists('aksrt_get_user_center_tab_url')) {
* Build a canonical full-page user-center tab URL.
*/
function aksrt_get_user_center_tab_url(string $tab): string {
$tab = sanitize_key($tab);
if ('invite' === $tab) {
$tab = 'promotion';
}
$url = remove_query_arg([
'tab', 'posts_page', 'comments_page', 'favorites_page', 'credits_page',
'post_status', 'saved', 'profile_error',
'order_tab', 'otab', 'order_status', 'order_page', 'order_type', 'section',
], aksrt_get_user_center_url());
return add_query_arg('tab', sanitize_key($tab), $url);
return add_query_arg('tab', $tab, $url);
}
}
@@ -150,6 +154,7 @@ if (!function_exists('aksrt_capture_user_center_view')) {
'vip' => 'vip',
'orders' => 'orders',
'auth' => 'auth',
'promotion' => 'promotion',
'settings' => 'settings',
'header' => 'header',
'sidebar' => 'sidebar',
@@ -174,7 +179,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', 'posts', 'comments', 'favorites', 'credits', 'vip', 'orders', 'auth', 'settings'];
$built_in_tabs = ['profile', 'level', 'posts', '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);
}
@@ -280,7 +285,7 @@ if (!function_exists('aksrt_user_center_resolve_tabs')) {
if ('signin' === $active || 'assets' === $active) {
$active = 'credits';
} elseif ('invite' === $active) {
$active = 'settings';
$active = 'promotion';
} elseif ('vip' === $active) {
// Prefer dedicated vip tab when registered; else credits (VIP shop).
$active = in_array('vip', $keys, true) ? 'vip' : 'credits';
@@ -339,7 +344,7 @@ if (!function_exists('aksrt_user_center_runtime_config')) {
'activeTab' => $active_tab,
'tabAliases' => [
'signin' => 'credits',
'invite' => 'settings',
'invite' => 'promotion',
'assets' => 'credits',
// vip → vip when panel exists; SPA may still map missing keys via server resolve.
'vip' => 'vip',