formatted(); $recharge = class_exists('\AKSRT\Settings\Settings') && method_exists('\AKSRT\Settings\Settings', 'get_payment_recharge_settings') ? \AKSRT\Settings\Settings::get_payment_recharge_settings() : []; $uid = (int) ($user_id ?? get_current_user_id()); $transfer_on = !empty($recharge['transfer']['enabled']); if ($transfer_on && class_exists('\AKSRT\Settings\Capabilities') && !\AKSRT\Settings\Capabilities::user_can('balance_transfer', $uid)) { $transfer_on = false; } $all_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_all() : []; $withdraw_on = !empty($all_settings['pay_balance_withdraw_s']); if ($withdraw_on && class_exists('\AKSRT\Settings\Capabilities') && !\AKSRT\Settings\Capabilities::user_can('balance_withdraw', $uid)) { $withdraw_on = false; } $withdraw_settings = class_exists('\\AKSRT\\Settings\\Settings') ? \AKSRT\Settings\Settings::get_withdrawal_settings() : []; $withdraw_min = $normalize_balance($withdraw_settings['min_amount'] ?? '50')->decimal(); $withdraw_usage = ['remaining_count' => 0, 'remaining_amount' => '0.00']; $withdraw_pending_hold = '0.00'; if ($withdraw_on && class_exists('\AKSRT\Payment\Withdrawal')) { $wd_svc = \AKSRT\Payment\Withdrawal::get_instance(); $withdraw_pending_hold = $wd_svc->sum_pending_hold((int) ($user_id ?? 0)); $withdraw_usage = $wd_svc->daily_usage((int) ($user_id ?? 0), $withdraw_settings); } // 卡密兑换总开关(后台 余额充值 → 卡密兑换 → 启用卡密兑换功能), // 通用弹窗支持余额 / 会员 / 积分三类卡密,类型由后端按卡密自动识别。 $card_pass_redeem = ['enabled' => false, 'desc' => '']; if (class_exists('\AKSRT\Payment\ChargeCard')) { $opts = \AKSRT\Payment\ChargeCard::get_instance()->get_public_options(); $card_pass_redeem = is_array($opts['balance'] ?? null) ? $opts['balance'] : $card_pass_redeem; } $charge_view = []; if (class_exists('\AKSRT\Credits\BalanceService')) { $charge_view = \AKSRT\Credits\BalanceService::get_instance()->get_charge_view((int) $user_id); } $packages = is_array($charge_view['packages'] ?? null) ? $charge_view['packages'] : []; $methods = is_array($charge_view['payment_methods'] ?? null) ? $charge_view['payment_methods'] : []; $custom_s = !empty($charge_view['custom_s']); $custom_limit = (int) ($charge_view['custom_limit'] ?? 9999); $mark = (string) ($charge_view['currency_mark'] ?? '元'); ?>
formatted())); ?>
'pay-balance-logo.svg', 'alipay' => 'pay-alipay-logo.svg', 'epay_alipay' => 'pay-alipay-logo.svg', 'wechatpay' => 'pay-wechat-logo.svg', 'epay_wxpay' => 'pay-wechat-logo.svg', 'paypal' => 'pay-paypal-logo.svg', 'stripe' => 'pay-stripe-logo.svg', ]; $charge_img_uri = get_template_directory_uri() . '/assets/img/'; $charge_default_product = $packages ? (string) $packages[0]['key'] : 'custom'; $charge_mark_symbol = !in_array($mark, ['', '元'], true); $charge_mark_html = $charge_mark_symbol ? '' . esc_html($mark) . '' : ''; $charge_unit = $charge_mark_symbol ? '' : (string) $mark; $charge_limit_html = sprintf(__('最低充值1%s,最高充值%s%s', 'aksrt'), $charge_unit, $charge_unit, $custom_limit); $charge_custom_block = static function () use ($mark, $charge_mark_html, $charge_unit, $charge_limit_html, $custom_limit) { ?>