feat(user-center): add VIP points exchange modal
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8518247755
commit
df858d04dc
4 files changed
+281
-13
No files matched your search
@@ -20,6 +20,15 @@ if (empty($vip_settings['enabled'])) {
|
||||
|
||||
$user_id = (int) ($user_id ?? get_current_user_id());
|
||||
$level = function_exists('aksrt_get_user_vip_level') ? aksrt_get_user_vip_level($user_id) : 0;
|
||||
$points_exchange = [];
|
||||
$user_points = 0;
|
||||
$currency_name = __('积分', 'aksrt');
|
||||
if (class_exists('\\AKSRT\\Content\\VipService')) {
|
||||
$vip_catalog = \AKSRT\Content\VipService::get_instance()->get_catalog($user_id);
|
||||
$points_exchange = is_array($vip_catalog['points_exchange'] ?? null) ? $vip_catalog['points_exchange'] : [];
|
||||
$user_points = (int) ($vip_catalog['user_points'] ?? 0);
|
||||
$currency_name = (string) ($vip_catalog['currency_name'] ?? $currency_name);
|
||||
}
|
||||
$expires = (int) get_user_meta($user_id, 'aksrt_vip_expires', true);
|
||||
$expired_level = (int) get_user_meta($user_id, 'aksrt_vip_level_expired', true);
|
||||
$levels = is_array($vip_settings['levels'] ?? null) ? $vip_settings['levels'] : [];
|
||||
@@ -136,14 +145,19 @@ foreach ([1, 2] as $lv) {
|
||||
$cards .= '</div></div>';
|
||||
}
|
||||
|
||||
// Points exchange (non-VIP only).
|
||||
// Points exchange entry (non-VIP only).
|
||||
$points_html = '';
|
||||
if ($level <= 0 && !empty($vip_settings['points_exchange']['enabled'])) {
|
||||
$points_html = '<div class="c-yellow zib-widget flex ac jsb uc-vip-points-link mt10">'
|
||||
. '<div class="flex1 em12 flex ac"><i class="fas fa-coins" aria-hidden="true"></i><span class="ml6">' . esc_html__('积分兑换会员', 'aksrt') . '</span></div>'
|
||||
. '<a class="badg radius c-yellow pay-vip" href="javascript:;" vip-level="1">'
|
||||
$points_pkgs = is_array($points_exchange['packages'] ?? null) ? $points_exchange['packages'] : [];
|
||||
if ($level <= 0 && !empty($points_exchange['enabled']) && $points_pkgs !== []) {
|
||||
$points_html = '<div class="uc-vip-points-link" data-aksrt-vip-points-modal>'
|
||||
. '<div class="uc-vip-points-link__icon" aria-hidden="true"><i class="fas fa-coins"></i></div>'
|
||||
. '<div class="uc-vip-points-link__body">'
|
||||
. '<strong>' . esc_html__('积分兑换会员', 'aksrt') . '</strong>'
|
||||
. '<span>' . sprintf(esc_html__('当前有 %1$s %2$s,可兑换专属会员权益', 'aksrt'), esc_html((string) $user_points), esc_html($currency_name)) . '</span>'
|
||||
. '</div>'
|
||||
. '<button type="button" class="uc-vip-points-link__action" data-aksrt-vip-points-open>'
|
||||
. esc_html__('立即兑换', 'aksrt')
|
||||
. ' <i class="fas fa-chevron-circle-right" aria-hidden="true"></i></a></div>';
|
||||
. ' <i class="fas fa-chevron-right" aria-hidden="true"></i></button></div>';
|
||||
}
|
||||
?>
|
||||
<div class="uc-vip-tab" data-aksrt-vip-tab>
|
||||
|
||||
Reference in new issue
Block a user