feat(user-center): merge promotion rewards into revenue
This commit is contained in:
+5
-31
@@ -91,12 +91,6 @@ class Center {
|
||||
'priority' => 50,
|
||||
'type' => 'panel',
|
||||
],
|
||||
'promotion' => [
|
||||
'label' => __('推广中心', 'aksrt'),
|
||||
'icon' => 'bullhorn',
|
||||
'priority' => 52,
|
||||
'type' => 'panel',
|
||||
],
|
||||
'revenue' => [
|
||||
'label' => __('收益中心', 'aksrt'),
|
||||
'icon' => 'chart-line',
|
||||
@@ -133,17 +127,9 @@ class Center {
|
||||
&& !empty(\AKSRT\User\Level::settings()['enabled']);
|
||||
$credits_on = class_exists('\AKSRT\Settings\Settings') && \AKSRT\Settings\Settings::credits_enabled();
|
||||
$balance_on = class_exists('\AKSRT\Credits\Balance') && \AKSRT\Credits\Balance::enabled();
|
||||
$invite_on = $credits_on
|
||||
&& class_exists('\AKSRT\Settings\Settings')
|
||||
&& \AKSRT\Settings\Settings::invite_enabled()
|
||||
&& \AKSRT\Settings\Settings::invite_registration_enabled();
|
||||
// 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'])
|
||||
);
|
||||
&& !empty(\AKSRT\Settings\Settings::get_payment_affiliate_settings()['enabled'])
|
||||
&& \AKSRT\Settings\Settings::invite_registration_enabled();
|
||||
$vip_on = class_exists('\AKSRT\Settings\Settings')
|
||||
&& !empty(\AKSRT\Settings\Settings::get_payment_vip_settings()['enabled']);
|
||||
|
||||
@@ -190,20 +176,10 @@ class Center {
|
||||
if (($credits_on || $balance_on) && !in_array('credits', $order, true)) {
|
||||
$order[] = 'credits';
|
||||
}
|
||||
if ($promotion_on && !in_array('promotion', $order, true)) {
|
||||
$insert_at = count($order);
|
||||
foreach (['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, ['promotion']);
|
||||
}
|
||||
|
||||
if ($revenue_tab_on && !in_array('revenue', $order, true)) {
|
||||
$insert_at = count($order);
|
||||
foreach (['promotion', 'credits', 'favorites', 'posts'] as $anchor) {
|
||||
foreach (['credits', 'favorites', 'posts'] as $anchor) {
|
||||
$idx = array_search($anchor, $order, true);
|
||||
if ($idx !== false) {
|
||||
$insert_at = (int) $idx + 1;
|
||||
@@ -234,9 +210,7 @@ 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