Merge pull request 'Worktree promotion center plan' (#390) from worktree-promotion-center-plan into main
Reviewed-on: CYL/wordpress-theme-aksrt#390
This commit is contained in:
@@ -5,4 +5,5 @@
|
||||
@import url("user-center/settings.css");
|
||||
@import url("revenue.css");
|
||||
@import url("user-center/revenue.css");
|
||||
@import url("user-center/promotion.css");
|
||||
@import url("user-center/responsive.css");
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* User Center — 推广中心 (promotion / invite) standalone tab.
|
||||
*
|
||||
* Hosts the [data-aksrt-invite] card moved out of the revenue tab. Priority
|
||||
* order: 成果概览 → 分享操作 → 奖励说明 → 邀请记录. Status/feedback are text
|
||||
* (data-invite-status / data-invite-copy-feedback), never colour-only.
|
||||
*/
|
||||
|
||||
/* Standalone panel: the uc-promotion-panel is the only card, so flatten the
|
||||
* generic dashboard-panel chrome (mirrors #panel-revenue / #panel-vip). */
|
||||
.uc-content #panel-promotion.dashboard-panel { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
|
||||
.uc-content .uc-promotion-page { padding: 4px 0; }
|
||||
|
||||
.uc-content .uc-promotion-panel { display: grid; gap: 18px; padding: 22px; border: 1px solid var(--color-line-soft, rgba(0,0,0,.06)); border-radius: 14px; background: var(--surface-1); }
|
||||
.uc-content .uc-promotion-card { margin: 0; }
|
||||
.uc-content .uc-promotion-panel__header { display: flex; align-items: center; gap: 12px; }
|
||||
.uc-content .uc-promotion-panel__icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #db2777, #f472b6); }
|
||||
.uc-content .uc-promotion-panel__eyebrow { margin: 0 0 2px; color: #b8377d; font-size: 12px; font-weight: 700; }
|
||||
.uc-content .uc-promotion-panel__header h3 { margin: 0; font-size: 19px; }
|
||||
.uc-content .uc-promotion-panel__intro,
|
||||
.uc-content .uc-promotion-section__header p { margin: 0; color: var(--color-ink-4); font-size: 13px; line-height: 1.65; }
|
||||
.uc-content .uc-promotion-panel__status { margin: 0; padding: 10px 12px; border-radius: 8px; color: var(--color-ink-3); background: var(--surface-2); font-size: 13px; }
|
||||
.uc-content .uc-promotion-panel__status.is-error,
|
||||
.uc-content .uc-promotion-copy-feedback.is-error { color: var(--color-error, #dc2626); }
|
||||
.uc-content .uc-promotion-section { padding-top: 2px; }
|
||||
.uc-content .uc-promotion-section h4 { margin: 0 0 4px; font-size: 15px; }
|
||||
|
||||
/* 成果概览 — the hero metric row. */
|
||||
.uc-content .uc-promotion-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 12px; border: 1px solid var(--color-line-soft, rgba(0,0,0,.06)); border-radius: 12px; overflow: hidden; }
|
||||
.uc-content .uc-promotion-stat { display: grid; gap: 4px; padding: 16px; border-right: 1px solid var(--color-line-soft, rgba(0,0,0,.06)); }
|
||||
.uc-content .uc-promotion-stat:last-child { border-right: 0; }
|
||||
.uc-content .uc-promotion-stat span,
|
||||
.uc-content .uc-promotion-stat small { color: var(--color-ink-4); font-size: 12px; }
|
||||
.uc-content .uc-promotion-stat strong { color: #b8377d; font-size: 28px; font-variant-numeric: tabular-nums; line-height: 1.1; }
|
||||
|
||||
/* 分享操作 — code + copyable link + primary button. */
|
||||
.uc-content .uc-promotion-share { display: grid; gap: 10px; margin-top: 12px; }
|
||||
.uc-content .uc-promotion-code { display: flex; align-items: baseline; gap: 10px; color: var(--color-ink-4); font-size: 13px; }
|
||||
.uc-content .uc-promotion-code strong { color: var(--color-ink); font-size: 19px; letter-spacing: .08em; }
|
||||
.uc-content .uc-promotion-link-row { display: flex; gap: 10px; }
|
||||
.uc-content .uc-promotion-link { flex: 1; min-width: 0; height: 42px; padding: 0 11px; border: 1px solid var(--color-line-soft, rgba(0,0,0,.1)); border-radius: 8px; background: var(--surface-2); }
|
||||
.uc-content .uc-promotion-copy { min-width: 108px; }
|
||||
.uc-content .uc-promotion-copy-feedback { min-height: 18px; margin: 0; color: var(--color-ink-4); font-size: 12px; }
|
||||
|
||||
/* 邀请记录 — list with per-row status badge + text. */
|
||||
.uc-content .uc-promotion-records__header { display: flex; justify-content: space-between; gap: 12px; }
|
||||
.uc-content .uc-promotion-record-list { display: grid; margin-top: 12px; }
|
||||
.uc-content .uc-promotion-record { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--color-line-soft, rgba(0,0,0,.06)); }
|
||||
.uc-content .uc-promotion-record__avatar { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; overflow: hidden; border-radius: 50%; background: var(--surface-2); }
|
||||
.uc-content .uc-promotion-record__avatar img { width: 100%; height: 100%; object-fit: cover; }
|
||||
.uc-content .uc-promotion-record__main { display: grid; flex: 1; min-width: 0; gap: 3px; }
|
||||
.uc-content .uc-promotion-record__main span,
|
||||
.uc-content .uc-promotion-record__status small { color: var(--color-ink-4); font-size: 12px; }
|
||||
.uc-content .uc-promotion-record__status { display: grid; justify-items: end; gap: 4px; }
|
||||
.uc-content .uc-promotion-badge { padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
|
||||
.uc-content .uc-promotion-badge.is-registered { color: #2563eb; background: rgba(37,99,235,.1); }
|
||||
.uc-content .uc-promotion-badge.is-verified { color: #7c3aed; background: rgba(124,58,237,.1); }
|
||||
.uc-content .uc-promotion-badge.is-rewarded { color: #16a34a; background: rgba(22,163,74,.1); }
|
||||
.uc-content .uc-promotion-record-empty { padding: 22px; border-top: 1px solid var(--color-line-soft, rgba(0,0,0,.06)); color: var(--color-ink-4); font-size: 13px; text-align: center; }
|
||||
|
||||
/* 键盘可聚焦:复制按钮与链接输入的可见焦点。 */
|
||||
.uc-content .uc-promotion-copy:focus-visible,
|
||||
.uc-content .uc-promotion-link:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
|
||||
|
||||
/* 移动端:单列、无横向溢出、复制按钮整行可点击。 */
|
||||
@media (max-width: 640px) {
|
||||
.uc-content .uc-promotion-panel { padding: 18px; }
|
||||
.uc-content .uc-promotion-stats { grid-template-columns: 1fr; }
|
||||
.uc-content .uc-promotion-stat { border-right: 0; border-bottom: 1px solid var(--color-line-soft, rgba(0,0,0,.06)); }
|
||||
.uc-content .uc-promotion-stat:last-child { border-bottom: 0; }
|
||||
.uc-content .uc-promotion-link-row { flex-direction: column; }
|
||||
.uc-content .uc-promotion-copy { width: 100%; }
|
||||
.uc-content .uc-promotion-record { align-items: flex-start; }
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
.uc-content .uc-revenue-card__header p { margin: 0 0 2px; color: var(--color-ink-4); font-size: 12px; }
|
||||
.uc-content .uc-revenue-card__header h3 { margin: 0; color: var(--color-ink); font-size: 18px; }
|
||||
.uc-content .uc-revenue-card .aksrt-revenue-page__stats { margin-bottom: 18px; }
|
||||
.uc-content .uc-promotion-card { margin-top: 0; }
|
||||
.uc-content #panel-revenue.dashboard-panel { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
|
||||
.uc-content .uc-revenue-panel { padding: 4px 0; }
|
||||
.uc-content .uc-revenue-panel__header { margin-bottom: 20px; }
|
||||
@@ -22,43 +21,4 @@
|
||||
.uc-content .aksrt-revenue-page__withdraw-form select,
|
||||
.uc-content .aksrt-revenue-page__withdraw-form textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--color-line-soft, rgba(0,0,0,.1)); border-radius: 8px; color: var(--color-ink); background: var(--surface-2); }
|
||||
.uc-content .aksrt-revenue-page__form-msg.is-error { color: var(--color-error, #dc2626); }
|
||||
.uc-content .uc-promotion-panel { display: grid; gap: 16px; margin-top: 24px; padding: 20px; border: 1px solid var(--color-line-soft, rgba(0,0,0,.06)); border-radius: 14px; background: var(--surface-1); }
|
||||
.uc-content .uc-promotion-panel__header { display: flex; align-items: center; gap: 12px; }
|
||||
.uc-content .uc-promotion-panel__icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: #fff; background: var(--color-primary); }
|
||||
.uc-content .uc-promotion-panel__eyebrow { margin: 0 0 2px; color: var(--color-primary); font-size: 12px; font-weight: 700; }
|
||||
.uc-content .uc-promotion-panel__header h3 { margin: 0; font-size: 18px; }
|
||||
.uc-content .uc-promotion-panel__intro,
|
||||
.uc-content .uc-promotion-section__header p { margin: 0; color: var(--color-ink-4); font-size: 13px; line-height: 1.65; }
|
||||
.uc-content .uc-promotion-panel__status { margin: 0; padding: 10px 12px; border-radius: 8px; color: var(--color-ink-3); background: var(--surface-2); font-size: 13px; }
|
||||
.uc-content .uc-promotion-panel__status.is-error,
|
||||
.uc-content .uc-promotion-copy-feedback.is-error { color: var(--color-error, #dc2626); }
|
||||
.uc-content .uc-promotion-section { padding-top: 4px; }
|
||||
.uc-content .uc-promotion-section h4 { margin: 0 0 4px; font-size: 15px; }
|
||||
.uc-content .uc-promotion-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 12px; border: 1px solid var(--color-line-soft, rgba(0,0,0,.06)); border-radius: 10px; overflow: hidden; }
|
||||
.uc-content .uc-promotion-stat { display: grid; gap: 4px; padding: 14px; border-right: 1px solid var(--color-line-soft, rgba(0,0,0,.06)); }
|
||||
.uc-content .uc-promotion-stat:last-child { border-right: 0; }
|
||||
.uc-content .uc-promotion-stat span,
|
||||
.uc-content .uc-promotion-stat small { color: var(--color-ink-4); font-size: 12px; }
|
||||
.uc-content .uc-promotion-stat strong { color: var(--color-primary); font-size: 26px; font-variant-numeric: tabular-nums; }
|
||||
.uc-content .uc-promotion-share { display: grid; gap: 10px; margin-top: 12px; }
|
||||
.uc-content .uc-promotion-code { display: flex; align-items: baseline; gap: 10px; color: var(--color-ink-4); font-size: 13px; }
|
||||
.uc-content .uc-promotion-code strong { color: var(--color-ink); font-size: 19px; letter-spacing: .08em; }
|
||||
.uc-content .uc-promotion-link-row { display: flex; gap: 10px; }
|
||||
.uc-content .uc-promotion-link { flex: 1; min-width: 0; height: 42px; padding: 0 11px; border: 1px solid var(--color-line-soft, rgba(0,0,0,.1)); border-radius: 8px; background: var(--surface-2); }
|
||||
.uc-content .uc-promotion-copy { min-width: 108px; }
|
||||
.uc-content .uc-promotion-copy-feedback { min-height: 18px; margin: 0; color: var(--color-ink-4); font-size: 12px; }
|
||||
.uc-content .uc-promotion-records__header { display: flex; justify-content: space-between; gap: 12px; }
|
||||
.uc-content .uc-promotion-record-list { display: grid; margin-top: 12px; }
|
||||
.uc-content .uc-promotion-record { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--color-line-soft, rgba(0,0,0,.06)); }
|
||||
.uc-content .uc-promotion-record__avatar { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; overflow: hidden; border-radius: 50%; background: var(--surface-2); }
|
||||
.uc-content .uc-promotion-record__avatar img { width: 100%; height: 100%; object-fit: cover; }
|
||||
.uc-content .uc-promotion-record__main { display: grid; flex: 1; min-width: 0; gap: 3px; }
|
||||
.uc-content .uc-promotion-record__main span,
|
||||
.uc-content .uc-promotion-record__status small { color: var(--color-ink-4); font-size: 12px; }
|
||||
.uc-content .uc-promotion-record__status { display: grid; justify-items: end; gap: 4px; }
|
||||
.uc-content .uc-promotion-badge { padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
|
||||
.uc-content .uc-promotion-badge.is-registered { color: #2563eb; background: rgba(37,99,235,.1); }
|
||||
.uc-content .uc-promotion-badge.is-verified { color: #7c3aed; background: rgba(124,58,237,.1); }
|
||||
.uc-content .uc-promotion-badge.is-rewarded { color: #16a34a; background: rgba(22,163,74,.1); }
|
||||
.uc-content .uc-promotion-record-empty { padding: 22px; border-top: 1px solid var(--color-line-soft, rgba(0,0,0,.06)); color: var(--color-ink-4); font-size: 13px; text-align: center; }
|
||||
@media (max-width: 640px) { .uc-content .aksrt-revenue-page__layout { grid-template-columns: 1fr; } .uc-content .uc-promotion-stats { grid-template-columns: 1fr; } .uc-content .uc-promotion-stat { border-right: 0; border-bottom: 1px solid var(--color-line-soft, rgba(0,0,0,.06)); } .uc-content .uc-promotion-stat:last-child { border-bottom: 0; } .uc-content .uc-promotion-link-row { flex-direction: column; } .uc-content .uc-promotion-copy { width: 100%; } }
|
||||
@media (max-width: 640px) { .uc-content .aksrt-revenue-page__layout { grid-template-columns: 1fr; } }
|
||||
|
||||
@@ -715,6 +715,7 @@ body.aksrt-user-center .uc-content,
|
||||
|
||||
.uc-service-grid__item--cart .uc-service-grid__icon { color: #dd6941; background: rgba(238, 109, 61, 0.12); }
|
||||
.uc-service-grid__item--level .uc-service-grid__icon { color: #9b6b0a; background: rgba(234, 179, 8, 0.13); }
|
||||
.uc-service-grid__item--promotion .uc-service-grid__icon { color: #b8377d; background: rgba(219, 39, 119, 0.12); }
|
||||
.uc-service-grid__item--auth .uc-service-grid__icon { color: #287bc4; background: rgba(14, 165, 233, 0.12); }
|
||||
.uc-service-grid__item--orders .uc-service-grid__icon { color: #c05621; background: rgba(234, 88, 12, 0.12); }
|
||||
.uc-service-grid__item--notice .uc-service-grid__icon { color: #d04b65; background: rgba(244, 63, 94, 0.11); }
|
||||
|
||||
@@ -104,7 +104,7 @@ if (!function_exists('aksrt_get_user_center_tab_url')) {
|
||||
function aksrt_get_user_center_tab_url(string $tab): string {
|
||||
$tab = sanitize_key($tab);
|
||||
if ('invite' === $tab || 'promotion' === $tab) {
|
||||
$tab = 'revenue';
|
||||
$tab = 'promotion';
|
||||
}
|
||||
$url = remove_query_arg([
|
||||
'tab', 'posts_page', 'comments_page', 'favorites_page', 'credits_page',
|
||||
@@ -154,6 +154,7 @@ if (!function_exists('aksrt_capture_user_center_view')) {
|
||||
'vip' => 'vip',
|
||||
'orders' => 'orders',
|
||||
'auth' => 'auth',
|
||||
'promotion' => 'promotion',
|
||||
'revenue' => 'revenue',
|
||||
'settings' => 'settings',
|
||||
'header' => 'header',
|
||||
@@ -179,7 +180,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', 'revenue', 'settings'];
|
||||
$built_in_tabs = ['profile', 'level', 'posts', 'comments', 'favorites', 'credits', 'vip', 'orders', 'auth', 'promotion', 'revenue', 'settings'];
|
||||
if (in_array($tab_key, $built_in_tabs, true)) {
|
||||
return aksrt_capture_user_center_view($tab_key, $context);
|
||||
}
|
||||
@@ -287,7 +288,7 @@ if (!function_exists('aksrt_user_center_resolve_tabs')) {
|
||||
if ('signin' === $active || 'assets' === $active) {
|
||||
$active = 'credits';
|
||||
} elseif ('invite' === $active || 'promotion' === $active) {
|
||||
$active = 'revenue';
|
||||
$active = 'promotion';
|
||||
} elseif ('vip' === $active) {
|
||||
// Prefer dedicated vip tab when registered; else credits (VIP shop).
|
||||
$active = in_array('vip', $keys, true) ? 'vip' : 'credits';
|
||||
@@ -346,8 +347,8 @@ if (!function_exists('aksrt_user_center_runtime_config')) {
|
||||
'activeTab' => $active_tab,
|
||||
'tabAliases' => [
|
||||
'signin' => 'credits',
|
||||
'invite' => 'revenue',
|
||||
'promotion' => 'revenue',
|
||||
'invite' => 'promotion',
|
||||
'promotion' => 'promotion',
|
||||
'assets' => 'credits',
|
||||
// vip → vip when panel exists; SPA may still map missing keys via server resolve.
|
||||
'vip' => 'vip',
|
||||
@@ -494,10 +495,6 @@ if (!function_exists('aksrt_get_user_center_render_context')) {
|
||||
$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_invite_section = $show_credit_tabs
|
||||
&& class_exists('\AKSRT\Settings\Settings')
|
||||
&& \AKSRT\Settings\Settings::invite_enabled()
|
||||
&& \AKSRT\Settings\Settings::invite_registration_enabled();
|
||||
$show_revenue_section = !empty($revenue_settings['enabled']) || !empty($affiliate_settings['enabled']);
|
||||
$new_post_url = function_exists('aksrt_get_new_post_url') ? aksrt_get_new_post_url() : '';
|
||||
$revenue_url = isset($tabs['tabs']['revenue'])
|
||||
@@ -549,7 +546,6 @@ if (!function_exists('aksrt_get_user_center_render_context')) {
|
||||
'balance_enabled' => $balance_enabled,
|
||||
'wallet_balance' => $wallet_balance,
|
||||
'vip_settings' => $vip_settings,
|
||||
'show_invite_section' => $show_invite_section,
|
||||
'user_email' => (string) $current_user->user_email,
|
||||
'runtime_config' => $runtime_config,
|
||||
'cover_upload_config' => aksrt_user_center_cover_upload_config($allow_bg_upload),
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* User center revenue invitation section.
|
||||
* User center promotion (invite) card.
|
||||
*
|
||||
* Rendered inside the standalone 推广中心 tab (profile-promotion.php).
|
||||
* Section order follows the task priority: 成果概览 → 分享操作 → 奖励说明 → 邀请记录.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* User center promotion panel (invite / 推广中心).
|
||||
*
|
||||
* Standalone dashboard tab that hosts the invite card. Reuses the existing
|
||||
* invite REST contract and credits.js `initInvite()` binding via the
|
||||
* `[data-aksrt-invite]` card in profile-invite.php.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
|
||||
$user_id = (int) ($context['user_id'] ?? get_current_user_id());
|
||||
if ($user_id <= 0) {
|
||||
echo '<div class="uc-panel-empty muted-2-color">' . esc_html__('请先登录', 'aksrt') . '</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
$currency_name = (string) ($context['currency_name'] ?? __('积分', 'aksrt'));
|
||||
?>
|
||||
<div class="uc-promotion-page" data-aksrt-promotion-page>
|
||||
<?php require __DIR__ . '/profile-invite.php'; ?>
|
||||
</div>
|
||||
@@ -15,7 +15,6 @@ if ($user_id <= 0) {
|
||||
}
|
||||
|
||||
$show_revenue_section = !empty($context['show_revenue_section']);
|
||||
$show_invite_section = !empty($context['show_invite_section']);
|
||||
$revenue_view = function_exists('aksrt_get_revenue_page_view')
|
||||
? aksrt_get_revenue_page_view($user_id)
|
||||
: ['balance' => 0, 'total_earned' => 0, 'total_withdrawn' => 0, 'records' => []];
|
||||
@@ -59,6 +58,4 @@ $revenue_url = static function (int $target_page): string {
|
||||
<section class="aksrt-revenue-page__section"><h3><?php esc_html_e('收益明细', 'aksrt'); ?></h3><?php if ($paged_records) : ?><div class="aksrt-revenue-page__list"><?php foreach ($paged_records as $record) : ?><div class="aksrt-revenue-page__item"><div><strong><?php echo esc_html((string) ($record['title'] ?? '')); ?></strong><time><?php echo esc_html((string) ($record['created_at'] ?? '')); ?></time></div><span class="<?php echo ($record['type'] ?? '') === 'withdrawal' ? 'is-out' : 'is-in'; ?>"><?php echo ($record['type'] ?? '') === 'withdrawal' ? '-' : '+'; ?>¥<?php echo esc_html(number_format_i18n((float) ($record['amount'] ?? 0), 2)); ?></span></div><?php endforeach; ?></div><?php if ($total_pages > 1) : ?><nav class="aksrt-revenue-page__pagination" aria-label="<?php esc_attr_e('收益分页', 'aksrt'); ?>"><?php for ($index = 1; $index <= $total_pages; $index++) : ?><a class="aksrt-revenue-page__page-chip<?php echo $index === $page ? ' is-active' : ''; ?>" href="<?php echo esc_url($revenue_url($index)); ?>"><?php echo esc_html((string) $index); ?></a><?php endfor; ?></nav><?php endif; ?><?php else : ?><p class="aksrt-revenue-page__empty"><?php esc_html_e('暂无收益明细', 'aksrt'); ?></p><?php endif; ?></section>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($show_invite_section) : require __DIR__ . '/profile-invite.php'; endif; ?>
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,7 @@ if ($creation_url === '' && $revenue_url === '') {
|
||||
<?php if ($revenue_url !== '') : ?>
|
||||
<a class="uc-center-card uc-center-card--revenue" href="<?php echo esc_url($revenue_url); ?>">
|
||||
<span class="uc-center-card__icon"><i class="fas fa-chart-line" aria-hidden="true"></i></span>
|
||||
<span><strong><?php esc_html_e('收益中心', 'aksrt'); ?></strong><small><?php esc_html_e('邀请、返佣与收益', 'aksrt'); ?></small></span>
|
||||
<span><strong><?php esc_html_e('收益中心', 'aksrt'); ?></strong><small><?php esc_html_e('返佣与收益提现', 'aksrt'); ?></small></span>
|
||||
<i class="fas fa-angle-right" aria-hidden="true"></i>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -11,6 +11,7 @@ $level_url = isset($dashboard_tabs['level'])
|
||||
? aksrt_get_user_center_tab_url('level')
|
||||
: '';
|
||||
$auth_url = isset($dashboard_tabs['auth']) ? aksrt_get_user_center_tab_url('auth') : '';
|
||||
$promotion_url = isset($dashboard_tabs['promotion']) ? aksrt_get_user_center_tab_url('promotion') : '';
|
||||
$orders_available = isset($dashboard_tabs['orders']);
|
||||
$orders_url = $orders_available ? (string) ($orders_url ?? '') : '';
|
||||
|
||||
@@ -21,6 +22,13 @@ $services = array_values(array_filter([
|
||||
'tone' => 'level',
|
||||
'url' => $level_url,
|
||||
],
|
||||
[
|
||||
'label' => __('推广中心', 'aksrt'),
|
||||
'icon' => 'bullhorn',
|
||||
'tone' => 'promotion',
|
||||
'url' => $promotion_url,
|
||||
'tab' => 'promotion',
|
||||
],
|
||||
[
|
||||
'label' => __('官方认证', 'aksrt'),
|
||||
'icon' => 'id-badge',
|
||||
|
||||
@@ -32,8 +32,8 @@ function aksrt_get_user_center_url(string $tab = ''): string {
|
||||
'assets' => 'credits',
|
||||
'vip' => 'vip', // dedicated vip tab when registered; resolver falls back if missing
|
||||
'signin' => 'credits',
|
||||
'invite' => 'revenue',
|
||||
'promotion' => 'revenue',
|
||||
'invite' => 'promotion',
|
||||
'promotion' => 'promotion',
|
||||
];
|
||||
if (isset($aliases[$tab])) {
|
||||
$tab = $aliases[$tab];
|
||||
|
||||
@@ -700,7 +700,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
|
||||
|| (
|
||||
(function_exists('aksrt_is_user_center_page') && aksrt_is_user_center_page())
|
||||
&& isset($_GET['tab'])
|
||||
&& in_array(sanitize_key((string) wp_unslash($_GET['tab'])), ['revenue', 'invite', 'promotion'], true)
|
||||
&& 'revenue' === sanitize_key((string) wp_unslash($_GET['tab']))
|
||||
);
|
||||
if ($is_revenue_surface) {
|
||||
$revenue_js = get_template_directory() . '/assets/js/revenue.js';
|
||||
|
||||
@@ -90,7 +90,7 @@ class UserRuntime {
|
||||
|
||||
// Built-in switchable panels. VIP is always auto-injected when enabled
|
||||
// by AKSRT\User\Center — keep it allowed for explicit config too.
|
||||
$allowed_tabs = ['profile', 'level', 'posts', 'comments', 'favorites', 'credits', 'revenue', 'vip', 'orders', 'auth', 'settings'];
|
||||
$allowed_tabs = ['profile', 'level', 'posts', 'comments', 'favorites', 'credits', 'promotion', 'revenue', 'vip', 'orders', 'auth', 'settings'];
|
||||
$normalized_tabs = ['profile'];
|
||||
|
||||
foreach ((array) $tabs as $tab) {
|
||||
|
||||
+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