' . esc_html__('请先登录', 'aksrt') . ''; return; } $affiliate = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_payment_affiliate_settings() : []; $affiliate_on = !empty($affiliate['enabled']); $withdrawal = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_withdrawal_settings() : []; $recharge = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_payment_recharge_settings() : []; $withdraw_on = $affiliate_on && !empty($recharge['enabled']); if ($withdraw_on && class_exists('\AKSRT\Settings\Capabilities') && !\AKSRT\Settings\Capabilities::user_can('balance_withdraw', $user_id)) { $withdraw_on = false; } $normalize_balance = static function ($value): \AKSRT\Ledger\AssetAmount { try { return \AKSRT\Ledger\AssetAmount::balance(is_string($value) ? $value : ''); } catch (\InvalidArgumentException $e) { return \AKSRT\Ledger\AssetAmount::balance('0'); } }; $signed_balance_minor = static function ($value) use ($normalize_balance): int { $value = is_string($value) ? trim($value) : ''; $negative = str_starts_with($value, '-'); $amount = $normalize_balance($negative ? substr($value, 1) : $value)->minor(); return $negative ? -$amount : $amount; }; $withdraw_min = $normalize_balance($withdrawal['min_amount'] ?? '50')->decimal(); $commission_stats = class_exists('\AKSRT\Payment\CommissionLedger') ? \AKSRT\Payment\CommissionLedger::get_instance()->overview($user_id) : ['total' => 0, 'pending' => 0, 'settled' => 0, 'wallet' => 0]; $pending_commission = $normalize_balance($commission_stats['pending'] ?? '0')->decimal(); $vip_ratios = []; $commission_ratio = class_exists('\AKSRT\Settings\Settings') ? (int) \AKSRT\Settings\Settings::affiliate_ratio_for_user($user_id) : 0; $details_text = trim((string) ($affiliate['promotion_text'] ?? '')); if ($details_text === '') { $details_text = __('好友通过推广链接完成符合条件的订单后,系统会按当前佣金比例记录返佣,结算后进入可提现余额。', 'aksrt'); } $revenue_request = is_array($context['revenue_request'] ?? null) ? $context['revenue_request'] : []; $active_reward_tab = sanitize_key((string) ($revenue_request['reward_tab'] ?? ($_GET['reward_tab'] ?? 'detail'))); if (!in_array($active_reward_tab, ['detail', 'orders', 'users'], true)) { $active_reward_tab = 'detail'; } if (!$affiliate_on && $active_reward_tab === 'orders') { $active_reward_tab = 'detail'; } $base_url = function_exists('aksrt_get_user_center_tab_url') ? aksrt_get_user_center_tab_url('revenue') : home_url('/user/revenue/'); $reward_url = static function (string $tab, array $extra = []) use ($base_url): string { return add_query_arg(array_merge(['reward_tab' => $tab], $extra), $base_url); }; $format_amount = static function ($amount) use ($normalize_balance): string { return $normalize_balance($amount)->formatted(); }; $commission_page = max(1, (int) ($revenue_request['commission_page'] ?? ($_GET['commission_page'] ?? 1))); $commission_view = class_exists('\AKSRT\Payment\CommissionLedger') ? \AKSRT\Payment\CommissionLedger::get_instance()->list_entries($user_id, [ 'per_page' => 10, 'page' => $commission_page, ]) : ['items' => [], 'total' => 0, 'max_pages' => 1, 'page' => 1]; $commission_items = (array) ($commission_view['items'] ?? []); $user_page = max(1, (int) ($_GET['user_page'] ?? 1)); $user_view = class_exists('\AKSRT\Payment\ReferralAttribution') ? \AKSRT\Payment\ReferralAttribution::get_instance()->list_referred_users($user_id, $user_page, 10) : ['items' => [], 'total' => 0, 'max_pages' => 1, 'page' => 1]; $user_total_pages = max(1, (int) ($user_view['max_pages'] ?? 1)); if ($user_page > $user_total_pages && class_exists('\AKSRT\Payment\ReferralAttribution')) { $user_page = $user_total_pages; $user_view = \AKSRT\Payment\ReferralAttribution::get_instance()->list_referred_users($user_id, $user_page, 10); } $commission_total_pages = max(1, (int) ($commission_view['max_pages'] ?? ceil(max(1, (int) ($commission_view['total'] ?? 0)) / 10))); if ($commission_page > $commission_total_pages) { $commission_page = $commission_total_pages; if (class_exists('\AKSRT\Payment\CommissionLedger')) { $commission_view = \AKSRT\Payment\CommissionLedger::get_instance()->list_entries($user_id, [ 'per_page' => 10, 'page' => $commission_page, ]); } } $commission_items = (array) ($commission_view['items'] ?? []); $status_labels = [ 'pending' => __('待结算', 'aksrt'), 'settled' => __('已结算', 'aksrt'), 'cancelled' => __('已取消', 'aksrt'), ]; ?>
%

0 ? esc_html__('普通用户推广订单返佣比例', 'aksrt') : esc_html__('暂未参与', 'aksrt'); ?>

¥

%
—
累计元待结算元

display_name : __('推广用户', 'aksrt'); ?>
1) : ?>

1) : ?>