feat(pay): enforce VIP free-download daily quota like zibll
This commit is contained in:
1 parent
7cce3ff275
commit
8b50687e9d
4 files changed
+199
-4
No files matched your search
@@ -282,7 +282,23 @@ $currency = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_currency_name()
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="resource-download-box__guarantees">
|
||||
<?php
|
||||
if (is_user_logged_in() && $cost <= 0 && function_exists('aksrt_get_user_free_download_limit')) {
|
||||
$dl_limit = aksrt_get_user_free_download_limit();
|
||||
if ($dl_limit > 0) {
|
||||
$dl_used = function_exists('aksrt_get_user_free_downloaded_number') ? aksrt_get_user_free_downloaded_number() : 0;
|
||||
$dl_surplus = max(0, $dl_limit - $dl_used);
|
||||
$vip_lv = function_exists('aksrt_get_user_vip_level') ? aksrt_get_user_vip_level() : 0;
|
||||
if ($dl_surplus <= 0) {
|
||||
echo '<div class="resource-download-box__quota-notice"><span class="badg c-red btn-block">' . esc_html__('您今日下载免费资源个数已超限,请明日再下载。', 'aksrt') . '</span></div>';
|
||||
} else {
|
||||
$who = $vip_lv > 0 ? esc_html__('您是尊贵的会员,', 'aksrt') : esc_html__('您', 'aksrt');
|
||||
echo '<div class="resource-download-box__quota-notice"><span class="badg c-red btn-block">' . $who . esc_html(sprintf(__('今日还可下载 %s 个免费资源', 'aksrt'), number_format_i18n($dl_surplus))) . '</span></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="resource-download-box__guarantees">
|
||||
<?php
|
||||
if (function_exists('aksrt_get_pay_service_html')) {
|
||||
echo aksrt_get_pay_service_html(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
|
||||
Reference in new issue
Block a user