feat: merge promotion and earnings center
This commit is contained in:
1 parent
f70eca09d1
commit
6dbb556d60
11 files changed
+65
-87
No files matched your search
@@ -1,27 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* User center promotion panel (invite / 推广中心).
|
||||
* Unified user-center promotion earnings panel.
|
||||
*
|
||||
* Standalone dashboard tab for the forward-only promotion contract.
|
||||
* The promotion tab is the single entry point for referral links, commission
|
||||
* details and withdrawals. The renderer lives in profile-revenue.php so the
|
||||
* existing earnings markup and AJAX refresh path remain in one place.
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
$settings = class_exists('\\AKSRT\\Settings\\Settings') ? \AKSRT\Settings\Settings::get_affiliate_settings() : [];
|
||||
?>
|
||||
<section class="uc-promotion-page aksrt-affiliate-panel" data-aksrt-promotion-page>
|
||||
<header class="uc-panel-heading"><h2><?php esc_html_e('推广中心', 'aksrt'); ?></h2><p><?php echo esc_html($settings['promotion_text'] ?? __('分享推广链接,好友完成会员或付费内容订单后获得佣金。', 'aksrt')); ?></p></header>
|
||||
<div class="uc-affiliate-link-card" data-affiliate-card><div><span class="muted-2-color"><?php esc_html_e('推广链接', 'aksrt'); ?></span><input type="text" readonly data-affiliate-link aria-label="<?php esc_attr_e('推广链接', 'aksrt'); ?>"></div><button type="button" class="btn-primary btn-sm" data-affiliate-copy><i class="fas fa-copy" aria-hidden="true"></i><?php esc_html_e('复制链接', 'aksrt'); ?></button><p data-affiliate-feedback role="status" aria-live="polite"></p></div>
|
||||
<div class="uc-affiliate-stats" data-affiliate-stats><article><span><?php esc_html_e('当前比例', 'aksrt'); ?></span><strong data-affiliate-ratio>—</strong></article><article><span><?php esc_html_e('推广人数', 'aksrt'); ?></span><strong data-affiliate-promoters>—</strong></article><article><span><?php esc_html_e('有效付费人数', 'aksrt'); ?></span><strong data-affiliate-payers>—</strong></article></div>
|
||||
<form class="uc-affiliate-accounts" data-affiliate-accounts><label><?php esc_html_e('支付宝收款码/账户', 'aksrt'); ?><input type="text" name="alipay" autocomplete="off"></label><label><?php esc_html_e('微信收款码/账户', 'aksrt'); ?><input type="text" name="wechat" autocomplete="off"></label><button type="submit" class="btn-secondary btn-sm"><?php esc_html_e('保存收款方式', 'aksrt'); ?></button><p data-affiliate-account-feedback role="status" aria-live="polite"></p></form>
|
||||
<p class="uc-affiliate-note"><?php esc_html_e('仅会员和付费内容订单参与返佣;首次触达后 30 天内绑定,禁止自邀和换绑。', 'aksrt'); ?></p>
|
||||
</section>
|
||||
require __DIR__ . '/profile-revenue.php';
|
||||
@@ -50,8 +50,8 @@ if (!in_array($active_reward_tab, ['detail', 'orders'], true)) {
|
||||
$active_reward_tab = 'detail';
|
||||
}
|
||||
$base_url = function_exists('aksrt_get_user_center_tab_url')
|
||||
? aksrt_get_user_center_tab_url('revenue')
|
||||
: home_url('/profile/?tab=revenue');
|
||||
? aksrt_get_user_center_tab_url('promotion')
|
||||
: home_url('/user/promotion/');
|
||||
$reward_url = static function (string $tab, array $extra = []) use ($base_url): string {
|
||||
return add_query_arg(array_merge(['reward_tab' => $tab], $extra), $base_url);
|
||||
};
|
||||
@@ -85,6 +85,34 @@ $status_labels = [
|
||||
];
|
||||
?>
|
||||
<div class="aksrt-revenue-page uc-revenue-panel" data-aksrt-revenue-page data-min-amount="<?php echo esc_attr((string) $withdraw_min); ?>">
|
||||
<section class="uc-affiliate-panel aksrt-affiliate-panel" data-aksrt-promotion-page aria-labelledby="uc-affiliate-title">
|
||||
<header class="uc-panel-heading">
|
||||
<h2 id="uc-affiliate-title"><?php esc_html_e('推广收益', 'aksrt'); ?></h2>
|
||||
<p><?php echo esc_html($affiliate['promotion_text'] ?? __('分享推广链接,好友完成会员或付费内容订单后获得佣金。', 'aksrt')); ?></p>
|
||||
</header>
|
||||
<div class="uc-affiliate-link-card" data-affiliate-card>
|
||||
<div>
|
||||
<span class="muted-2-color"><?php esc_html_e('推广链接', 'aksrt'); ?></span>
|
||||
<input type="text" readonly data-affiliate-link aria-label="<?php esc_attr_e('推广链接', 'aksrt'); ?>">
|
||||
</div>
|
||||
<button type="button" class="btn-primary btn-sm" data-affiliate-copy>
|
||||
<i class="fas fa-copy" aria-hidden="true"></i><?php esc_html_e('复制链接', 'aksrt'); ?>
|
||||
</button>
|
||||
<p data-affiliate-feedback role="status" aria-live="polite"></p>
|
||||
</div>
|
||||
<div class="uc-affiliate-stats" data-affiliate-stats>
|
||||
<article><span><?php esc_html_e('当前比例', 'aksrt'); ?></span><strong data-affiliate-ratio>—</strong></article>
|
||||
<article><span><?php esc_html_e('推广人数', 'aksrt'); ?></span><strong data-affiliate-promoters>—</strong></article>
|
||||
<article><span><?php esc_html_e('有效付费人数', 'aksrt'); ?></span><strong data-affiliate-payers>—</strong></article>
|
||||
</div>
|
||||
<form class="uc-affiliate-accounts" data-affiliate-accounts>
|
||||
<label><?php esc_html_e('支付宝收款码/账户', 'aksrt'); ?><input type="text" name="alipay" autocomplete="off"></label>
|
||||
<label><?php esc_html_e('微信收款码/账户', 'aksrt'); ?><input type="text" name="wechat" autocomplete="off"></label>
|
||||
<button type="submit" class="btn-secondary btn-sm"><?php esc_html_e('保存收款方式', 'aksrt'); ?></button>
|
||||
<p data-affiliate-account-feedback role="status" aria-live="polite"></p>
|
||||
</form>
|
||||
<p class="uc-affiliate-note"><?php esc_html_e('仅会员和付费内容订单参与返佣;首次触达后 30 天内绑定,禁止自邀和换绑。', 'aksrt'); ?></p>
|
||||
</section>
|
||||
<section class="uc-commission-summary" aria-label="<?php esc_attr_e('佣金概览', 'aksrt'); ?>">
|
||||
<article class="uc-commission-card uc-commission-card--ratio">
|
||||
<div class="uc-commission-card__icon"><i class="fas fa-percentage" aria-hidden="true"></i></div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* User center sidebar: creation and revenue center pair.
|
||||
* User center sidebar: creation center card.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
@@ -8,9 +8,8 @@
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$creation_url = isset($dashboard_tabs['creator']) ? aksrt_get_user_center_tab_url('creator') : '';
|
||||
$revenue_url = (string) ($revenue_url ?? '');
|
||||
|
||||
if ($creation_url === '' && $revenue_url === '') {
|
||||
if ($creation_url === '') {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
@@ -22,11 +21,4 @@ if ($creation_url === '' && $revenue_url === '') {
|
||||
<i class="fas fa-angle-right" aria-hidden="true"></i>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($revenue_url !== '') : ?>
|
||||
<a class="uc-center-card uc-center-card--revenue" href="<?php echo esc_url($revenue_url); ?>" data-tab="revenue">
|
||||
<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>
|
||||
<i class="fas fa-angle-right" aria-hidden="true"></i>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -10,31 +10,11 @@ defined('ABSPATH') || exit;
|
||||
$level_url = isset($dashboard_tabs['level'])
|
||||
? aksrt_get_user_center_tab_url('level')
|
||||
: '';
|
||||
$promotion_url = isset($dashboard_tabs['promotion'])
|
||||
? aksrt_get_user_center_tab_url('promotion')
|
||||
: '';
|
||||
$revenue_url = isset($dashboard_tabs['revenue'])
|
||||
? aksrt_get_user_center_tab_url('revenue')
|
||||
: '';
|
||||
$auth_url = isset($dashboard_tabs['auth']) ? aksrt_get_user_center_tab_url('auth') : '';
|
||||
$orders_available = isset($dashboard_tabs['orders']);
|
||||
$orders_url = $orders_available ? (string) ($orders_url ?? '') : '';
|
||||
|
||||
$services = array_values(array_filter([
|
||||
[
|
||||
'label' => __('推广中心', 'aksrt'),
|
||||
'icon' => 'share-alt',
|
||||
'tone' => 'promotion',
|
||||
'url' => $promotion_url,
|
||||
'tab' => 'promotion',
|
||||
],
|
||||
[
|
||||
'label' => __('收益中心', 'aksrt'),
|
||||
'icon' => 'chart-line',
|
||||
'tone' => 'revenue',
|
||||
'url' => $revenue_url,
|
||||
'tab' => 'revenue',
|
||||
],
|
||||
[
|
||||
'label' => __('我的等级', 'aksrt'),
|
||||
'icon' => 'chart-line',
|
||||
|
||||
Reference in new issue
Block a user