feat(pay): enable points card-pass redeem in user center

Wire zibll-style points_pass_exchange settings, open credits redeem options, and add 卡密兑换积分 UI on the credits panel.
This commit is contained in:
2026-07-14 21:50:05 +08:00
parent 6bad39a7ba
commit dc28fafcc3
4 changed files with 64 additions and 12 deletions
@@ -437,6 +437,11 @@ class AKSRT_Admin_Schema_Users {
['key' => 'points_deduction_rate', 'label' => '抵扣比例(%)', 'type' => 'number', 'default' => 100, 'min' => 1, 'max' => 100],
['key' => 'points_deduction_max', 'label' => '最大抵扣比例(%)', 'type' => 'number', 'default' => 50, 'min' => 1, 'max' => 100],
]],
['key' => 'card_pass', 'title' => '积分卡密兑换', 'fields' => [
['key' => 'points_pass_exchange_s', 'label' => '启用积分卡密兑换', 'type' => 'switch', 'default' => false],
['key' => 'points_pass_exchange_desc', 'label' => '兑换说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'points_pass_exchange_s', 'value' => true]],
['key' => 'points_pass_exchange_only_password', 'label' => '仅密码兑换', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'points_pass_exchange_s', 'value' => true]],
]],
['key' => 'display', 'title' => '展示设置', 'fields' => [
['key' => 'points_show_balance', 'label' => '导航栏显示余额', 'type' => 'switch', 'default' => true],
['key' => 'points_show_log', 'label' => '显示积分记录', 'type' => 'switch', 'default' => true],
+24 -12
View File
@@ -138,22 +138,34 @@ class AKSRT_Charge_Card {
}
}
// Points card-pass: zibll points_pass_exchange_* (stored in aksrt_settings).
$credits = ['enabled' => false, 'desc' => '', 'only_password' => true];
$all = class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'get_all')
? AKSRT_Settings::get_all()
: (array) get_option('aksrt_settings', []);
if (!empty($all['points_pass_exchange_s'])) {
// Require credits system on when available.
$credits_on = !class_exists('AKSRT_Settings') || !method_exists('AKSRT_Settings', 'credits_enabled') || AKSRT_Settings::credits_enabled();
$credits = [
'enabled' => $credits_on,
'desc' => sanitize_textarea_field((string) ($all['points_pass_exchange_desc'] ?? '')),
'only_password' => !isset($all['points_pass_exchange_only_password']) || !empty($all['points_pass_exchange_only_password']),
];
}
return [
'balance' => $balance,
'vip' => $vip,
'credits' => [
'enabled' => false,
'desc' => '',
'only_password' => true,
],
'credits' => $credits,
'labels' => [
'title' => __('卡密兑换', 'aksrt'),
'password' => __('卡密', 'aksrt'),
'card' => __('卡号', 'aksrt'),
'submit_balance' => __('兑换余额', 'aksrt'),
'submit_vip' => __('兑换会员', 'aksrt'),
'placeholder_pw' => __('请输入卡密', 'aksrt'),
'placeholder_card'=> __('请输入卡号', 'aksrt'),
'title' => __('卡密兑换', 'aksrt'),
'password' => __('卡密', 'aksrt'),
'card' => __('卡号', 'aksrt'),
'submit_balance' => __('兑换余额', 'aksrt'),
'submit_vip' => __('兑换会员', 'aksrt'),
'submit_credits' => __('兑换积分', 'aksrt'),
'placeholder_pw' => __('请输入卡密', 'aksrt'),
'placeholder_card' => __('请输入卡号', 'aksrt'),
],
];
}