feat(users): normalize center routes and withdrawal limits

This commit is contained in:
2026-08-12 19:44:47 +08:00
parent 9004f7093f
commit dacd0095bf
24 changed files with 326 additions and 174 deletions
+1
View File
@@ -245,6 +245,7 @@ class SchemaPageDisplay {
'option_key' => 'aksrt_settings',
'groups' => [
['key' => 'layout', 'title' => '主页布局', 'fields' => [
['key' => 'user_home_route_identifier', 'label' => '主页 URL 标识', 'type' => 'select', 'default' => 'nicename', 'options' => [['label' => '用户名 URL slug', 'value' => 'nicename'], ['label' => '数字用户 ID', 'value' => 'uid']]],
['key' => 'user_home_cover', 'label' => '封面区域', 'type' => 'switch', 'default' => true],
['key' => 'user_home_sidebar', 'label' => '侧边栏(已弃用)', 'type' => 'switch', 'default' => false, 'help' => '公开主页对齐 Zibll 作者页为通栏布局;交易/快捷入口仅在用户中心展示。此开关保留兼容,运行时强制关闭。'],
['key' => 'user_home_follow', 'label' => '关注按钮', 'type' => 'switch', 'default' => true],
+5 -6
View File
@@ -97,7 +97,6 @@ class SchemaPayment {
]],
['key' => 'withdraw', 'title' => '余额提现', 'fields' => [
['key' => 'pay_balance_withdraw_s', 'label' => '启用余额提现', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
['key' => 'pay_balance_withdraw_lowest_money', 'label' => '最低提现金额', 'type' => 'number', 'default' => 50, 'min' => 1, 'max' => 99999, 'dependsOn' => ['key' => 'pay_balance_withdraw_s', 'value' => true]],
]],
],
],
@@ -373,11 +372,11 @@ class SchemaPayment {
'option_key' => 'aksrt_settings',
'groups' => [
['key' => 'basic', 'title' => '提现设置', 'fields' => [
['key' => 'pay_rebate_withdraw_lowest_money', 'label' => '最低提现金额', 'type' => 'number', 'default' => 50, 'min' => 1, 'max' => 99999],
['key' => 'withdraw_service_charge', 'label' => '提现手续费(%)', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 50],
['key' => 'pay_rebate_withdraw_text_details', 'label' => '提现说明', 'type' => 'textarea', 'default' => '<div>可提现金额达到50元后即可发起提现</div>
<div>申请提现需后台人工处理,一般2-3小时,请耐心等待</div>
<div>如有其它疑问,请与客服联系</div>'],
['key' => 'pay_rebate_withdraw_lowest_money', 'label' => '最低提现金额', 'type' => 'number', 'default' => 50, 'min' => 0, 'max' => 99999],
['key' => 'withdraw_service_charge', 'label' => '提现手续费(%)', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 50],
['key' => 'withdraw_daily_count', 'label' => '每日可提现次数', 'type' => 'number', 'default' => 3, 'min' => 0, 'max' => 99999, 'sanitize_type' => 'int'],
['key' => 'withdraw_daily_limit', 'label' => '每日提现上限', 'type' => 'number', 'default' => 50, 'min' => 0, 'max' => 999999],
['key' => 'withdraw_reset_time', 'label' => '重置时间', 'type' => 'input', 'default' => '00:00', 'help' => '按站点 WordPress 时区重置,格式 HH:MM。'],
]],
],
],
+22
View File
@@ -207,6 +207,24 @@ class SchemaProvider {
}
}
if ($domain === 'payment' && $section === 'withdrawal') {
$stored = get_option('aksrt_settings', []);
$merged = is_array($stored) ? array_merge($stored, $data) : $data;
$count = $merged['withdraw_daily_count'] ?? 3;
$min = (float) ($merged['pay_rebate_withdraw_lowest_money'] ?? 50);
$limit = (float) ($merged['withdraw_daily_limit'] ?? 50);
$time = (string) ($merged['withdraw_reset_time'] ?? '00:00');
if (filter_var($count, FILTER_VALIDATE_INT) === false || (int) $count < 0) {
$errors[] = __('每日可提现次数必须是非负整数', 'aksrt');
}
if ($limit < $min) {
$errors[] = __('每日提现上限不得低于最低提现金额', 'aksrt');
}
if (preg_match('/^(?:[01]\\d|2[0-3]):[0-5]\\d$/', $time) !== 1) {
$errors[] = __('重置时间必须为 HH:MM', 'aksrt');
}
}
return ['valid' => empty($errors), 'errors' => $errors];
}
@@ -318,6 +336,10 @@ class SchemaProvider {
$stored[$key] = $value;
}
if (($schema['key'] ?? '') === 'withdrawal') {
unset($stored['pay_rebate_withdraw_text_details'], $stored['pay_balance_withdraw_lowest_money']);
}
// Captcha: keep enabled_scenarios / disabled_scenarios mirrors in sync.
if ($option_key === 'aksrt_captcha_config' && function_exists('aksrt_captcha_scenes')) {
$all = array_keys(aksrt_captcha_scenes());