feat(pay): zibll-style pay_modo/points/pay_limit, VIP quota, and local speed stream
Expand post pay meta with cash/points modes and member purchase limits, enforce free-download daily quotas, and stream local files with VIP speed caps while keeping remote links on redirect.
This commit is contained in:
@@ -374,19 +374,45 @@ if (!function_exists('aksrt_is_download_alone_page_enabled')) {
|
||||
if (!function_exists('aksrt_get_pay_price_label')) {
|
||||
function aksrt_get_pay_price_label($post = null): array {
|
||||
$meta = aksrt_get_pay_meta($post);
|
||||
$price = (float) $meta['price'];
|
||||
$pay_modo = (($meta['pay_modo'] ?? '0') === 'points') ? 'points' : '0';
|
||||
$pay_limit = (int) ($meta['pay_limit'] ?? 0);
|
||||
$currency = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_currency_name() : __('积分', 'aksrt');
|
||||
|
||||
if ($meta['pay_type'] === AKSRT_PAY_TYPE_VIP) {
|
||||
return ['text' => __('VIP 专属', 'aksrt'), 'free' => false, 'amount' => 0];
|
||||
$cash_symbol = '¥';
|
||||
if (class_exists('AKSRT_Settings')) {
|
||||
$paid = AKSRT_Settings::get_paid_content_settings();
|
||||
$cash_symbol = (string) ($paid['display']['currency_symbol'] ?? '¥');
|
||||
}
|
||||
|
||||
if ($meta['pay_type'] === AKSRT_PAY_TYPE_VIP || $pay_limit > 0) {
|
||||
return ['text' => __('会员专属', 'aksrt'), 'free' => false, 'amount' => 0, 'modo' => $pay_modo, 'pay_limit' => $pay_limit];
|
||||
}
|
||||
|
||||
if ($pay_modo === 'points') {
|
||||
$price = (int) ($meta['points_price'] ?? 0);
|
||||
if ($price <= 0) {
|
||||
return ['text' => __('免费', 'aksrt'), 'free' => true, 'amount' => 0, 'modo' => 'points', 'pay_limit' => 0];
|
||||
}
|
||||
return [
|
||||
'text' => sprintf(__('%s %s', 'aksrt'), aksrt_format_price((float) $price), $currency),
|
||||
'free' => false,
|
||||
'amount' => (float) $price,
|
||||
'modo' => 'points',
|
||||
'pay_limit' => 0,
|
||||
];
|
||||
}
|
||||
|
||||
$price = (float) $meta['price'];
|
||||
if ($price <= 0) {
|
||||
return ['text' => __('免费', 'aksrt'), 'free' => true, 'amount' => 0];
|
||||
return ['text' => __('免费', 'aksrt'), 'free' => true, 'amount' => 0, 'modo' => '0', 'pay_limit' => 0];
|
||||
}
|
||||
|
||||
$amount = aksrt_format_price($price);
|
||||
return ['text' => sprintf(__('%s %s', 'aksrt'), $amount, $currency), 'free' => false, 'amount' => $price];
|
||||
return [
|
||||
'text' => $cash_symbol . aksrt_format_price($price),
|
||||
'free' => false,
|
||||
'amount' => $price,
|
||||
'modo' => '0',
|
||||
'pay_limit' => 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user