feat(user-center): promote invite into standalone 推广中心 tab
Register a dedicated `promotion` dashboard panel gated by the existing invite switches (credits + invite reward + invite registration), and move the invite card out of the revenue tab so 收益中心 is pure earnings/withdrawal. - src/User/Center.php: register promotion panel; revenue no longer depends on invite being on - inc/helpers/user-center-renderers/profile-promotion.php: new panel body hosting the existing [data-aksrt-invite] card - profile-revenue.php: drop the invite section; aksrt-user-center.php: drop unused show_invite_section context, add promotion to built-in tabs + view map - repoint invite/promotion deep-link aliases from revenue to promotion across tab-url builder, tab resolver, runtime tabAliases, urls.php, and the revenue-JS enqueue gate - sidebar-nav.php: add 推广中心 service entry; shell.css: entry icon color; sidebar-creator.php: reword revenue card - UserRuntime.php: allow promotion in configurable tabs
This commit is contained in:
+24
-3
@@ -91,6 +91,12 @@ class Center {
|
||||
'priority' => 50,
|
||||
'type' => 'panel',
|
||||
],
|
||||
'promotion' => [
|
||||
'label' => __('推广中心', 'aksrt'),
|
||||
'icon' => 'bullhorn',
|
||||
'priority' => 52,
|
||||
'type' => 'panel',
|
||||
],
|
||||
'revenue' => [
|
||||
'label' => __('收益中心', 'aksrt'),
|
||||
'icon' => 'chart-line',
|
||||
@@ -131,12 +137,13 @@ class Center {
|
||||
&& class_exists('\AKSRT\Settings\Settings')
|
||||
&& \AKSRT\Settings\Settings::invite_enabled()
|
||||
&& \AKSRT\Settings\Settings::invite_registration_enabled();
|
||||
$revenue_on = class_exists('\AKSRT\Settings\Settings')
|
||||
// Promotion (invite) center is its own tab; revenue stays pure earnings/withdrawal.
|
||||
$promotion_on = $invite_on;
|
||||
$revenue_tab_on = class_exists('\AKSRT\Settings\Settings')
|
||||
&& (
|
||||
!empty(\AKSRT\Settings\Settings::get_payment_revenue_settings()['enabled'])
|
||||
|| !empty(\AKSRT\Settings\Settings::get_payment_affiliate_settings()['enabled'])
|
||||
);
|
||||
$revenue_tab_on = $revenue_on || $invite_on;
|
||||
$vip_on = class_exists('\AKSRT\Settings\Settings')
|
||||
&& !empty(\AKSRT\Settings\Settings::get_payment_vip_settings()['enabled']);
|
||||
|
||||
@@ -183,7 +190,7 @@ class Center {
|
||||
if (($credits_on || $balance_on) && !in_array('credits', $order, true)) {
|
||||
$order[] = 'credits';
|
||||
}
|
||||
if ($revenue_tab_on && !in_array('revenue', $order, true)) {
|
||||
if ($promotion_on && !in_array('promotion', $order, true)) {
|
||||
$insert_at = count($order);
|
||||
foreach (['credits', 'favorites', 'posts'] as $anchor) {
|
||||
$idx = array_search($anchor, $order, true);
|
||||
@@ -192,6 +199,17 @@ class Center {
|
||||
break;
|
||||
}
|
||||
}
|
||||
array_splice($order, $insert_at, 0, ['promotion']);
|
||||
}
|
||||
if ($revenue_tab_on && !in_array('revenue', $order, true)) {
|
||||
$insert_at = count($order);
|
||||
foreach (['promotion', 'credits', 'favorites', 'posts'] as $anchor) {
|
||||
$idx = array_search($anchor, $order, true);
|
||||
if ($idx !== false) {
|
||||
$insert_at = (int) $idx + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
array_splice($order, $insert_at, 0, ['revenue']);
|
||||
}
|
||||
$auth_on = class_exists('\AKSRT\User\AuthApply')
|
||||
@@ -216,6 +234,9 @@ class Center {
|
||||
if ($key === 'revenue' && !$revenue_tab_on) {
|
||||
continue;
|
||||
}
|
||||
if ($key === 'promotion' && !$promotion_on) {
|
||||
continue;
|
||||
}
|
||||
if ($key === 'vip' && !$vip_on) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user