feat(pay): sales volume, paid order meta, pending resume, limit-over buy
Bump content sales on resource order paid; show order number/time in download box; poll pending gateway payments; support download_limit_over_price overbuy.
This commit is contained in:
@@ -170,6 +170,13 @@ if ($is_need_purchase && $user_amount > 0) {
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
$paid_order = null;
|
||||
if ($has_paid_access && is_user_logged_in() && function_exists('aksrt_get_user_content_paid_order')) {
|
||||
$paid_order = aksrt_get_user_content_paid_order((int) $post_id);
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="resource-download-box__body">
|
||||
<?php if ($has_thumbnail) : ?>
|
||||
<div class="resource-download-box__thumb-col">
|
||||
@@ -194,6 +201,31 @@ if ($is_need_purchase && $user_amount > 0) {
|
||||
</span>
|
||||
</header>
|
||||
|
||||
<?php if ($has_paid_access && $user_amount > 0) : ?>
|
||||
<div class="resource-download-box__pricing">
|
||||
<span class="resource-download-box__price is-free"><?php esc_html_e('已解锁', 'aksrt'); ?></span>
|
||||
<?php echo $pay_type_badge && !$has_thumbnail ? $pay_type_badge : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
</div>
|
||||
<?php if (is_array($paid_order) && !empty($paid_order['order_number'])) : ?>
|
||||
<div class="resource-download-box__paid-meta">
|
||||
<span><?php printf(esc_html__('订单号:%s', 'aksrt'), esc_html((string) $paid_order['order_number'])); ?></span>
|
||||
<?php if (!empty($paid_order['paid_at'])) : ?>
|
||||
<span><?php printf(esc_html__('支付时间:%s', 'aksrt'), esc_html((string) $paid_order['paid_at'])); ?></span>
|
||||
<?php endif; ?>
|
||||
<span>
|
||||
<?php
|
||||
$paid_amt = (float) ($paid_order['amount'] ?? 0);
|
||||
$paid_cur = (string) ($paid_order['currency'] ?? '');
|
||||
if ($paid_cur === 'points') {
|
||||
printf(esc_html__('实付:%s %s', 'aksrt'), esc_html(function_exists('aksrt_format_price') ? aksrt_format_price($paid_amt) : (string) $paid_amt), esc_html($currency));
|
||||
} else {
|
||||
printf(esc_html__('实付:%s%s', 'aksrt'), esc_html($cash_symbol), esc_html(function_exists('aksrt_format_price') ? aksrt_format_price($paid_amt) : (string) $paid_amt));
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<div class="resource-download-box__pricing">
|
||||
<span class="resource-download-box__price<?php echo !empty($price_label['free']) || $has_paid_access ? ' is-free' : ''; ?>">
|
||||
<?php
|
||||
@@ -217,6 +249,7 @@ if ($is_need_purchase && $user_amount > 0) {
|
||||
<?php endif; ?>
|
||||
<?php echo $pay_type_badge && !$has_thumbnail ? $pay_type_badge : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($has_vip && !$member_blocked && !$has_paid_access) : ?>
|
||||
<div class="resource-download-box__vip-pricing">
|
||||
@@ -380,8 +413,17 @@ if ($is_need_purchase && $user_amount > 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;
|
||||
$over_price = max(0.0, (float) ($meta['download_limit_over_price'] ?? 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>';
|
||||
if ($over_price > 0 && !$has_paid_access) {
|
||||
$over_label = $pay_modo === 'points'
|
||||
? sprintf(__('立即购买(%s %s)', 'aksrt'), function_exists('aksrt_format_price') ? aksrt_format_price($over_price) : (string) $over_price, $currency)
|
||||
: sprintf(__('立即购买(%s%s)', 'aksrt'), $cash_symbol, function_exists('aksrt_format_price') ? aksrt_format_price($over_price) : (string) $over_price);
|
||||
echo '<div class="mt10 resource-download-box__purchase-gate">';
|
||||
echo '<button type="button" class="resource-download-box__btn btn-primary resource-download-box__btn--purchase cashier-link" data-action="aksrt-need-purchase" data-aksrt-pay-content="' . esc_attr((string) $post_id) . '" data-post-id="' . esc_attr((string) $post_id) . '" data-price-type="download_limit_over" data-pay-modo="' . esc_attr($pay_modo) . '" data-amount="' . esc_attr((string) $over_price) . '">';
|
||||
echo '<i class="fas fa-shopping-cart" aria-hidden="true"></i><span>' . esc_html($over_label) . '</span></button></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>';
|
||||
|
||||
Reference in New Issue
Block a user