✨ 添加注册自动审核功能
- 系统配置新增:自动审核开关、每小时注册限制、赠送VIP天数 - 数据库:添加 auto_approve_enabled, auto_approve_hourly_limit, auto_approve_vip_days 字段 - 后端API:支持保存和读取自动审核配置 - 管理后台:新增注册自动审核配置区域(绿色背景) - 注册逻辑:支持自动审核通过并赠送VIP 功能说明: 1. 启用自动审核后,新用户注册自动通过,无需管理员审批 2. 每小时注册限制防止恶意注册 3. 可配置注册赠送VIP天数(设为0则不赠送) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -713,6 +713,42 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- ========== 代理设置结束 ========== -->
|
||||
|
||||
<!-- ========== 注册自动审核设置 ========== -->
|
||||
<div style="border-top: 2px solid #f0f0f0; margin-top: 40px; padding-top: 25px; background-color: #e8f5e9; padding: 20px; border-radius: 8px;">
|
||||
<h3 style="margin-bottom: 15px; font-size: 16px;">✅ 注册自动审核</h3>
|
||||
|
||||
<div class="form-group">
|
||||
<label style="display: flex; align-items: center; gap: 10px;">
|
||||
<input type="checkbox" id="autoApproveEnabled" style="width: auto; max-width: none;">
|
||||
启用自动审核
|
||||
</label>
|
||||
<div style="font-size: 12px; color: #666; margin-top: 5px;">
|
||||
开启后,新用户注册将自动通过审核,无需管理员手动审批
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>每小时注册限制</label>
|
||||
<input type="number" id="autoApproveHourlyLimit" min="1" value="10" style="max-width: 200px; padding: 10px; border: 1px solid #ddd; border-radius: 5px; font-size: 14px;">
|
||||
<div style="font-size: 12px; color: #666; margin-top: 5px;">
|
||||
限制每小时内最多允许注册的用户数量,防止恶意注册
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>注册赠送VIP天数</label>
|
||||
<input type="number" id="autoApproveVipDays" min="0" value="7" style="max-width: 200px; padding: 10px; border: 1px solid #ddd; border-radius: 5px; font-size: 14px;">
|
||||
<div style="font-size: 12px; color: #666; margin-top: 5px;">
|
||||
新用户注册成功后自动赠送的VIP天数(设为0表示不赠送)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 15px;">
|
||||
<button class="btn btn-primary" onclick="saveAutoApproveConfig()">💾 保存自动审核配置</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ========== 注册自动审核结束 ========== -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1398,6 +1434,11 @@
|
||||
|
||||
// 显示/隐藏定时任务选项
|
||||
toggleSchedule(config.schedule_enabled === 1);
|
||||
|
||||
// 加载自动审核配置
|
||||
document.getElementById('autoApproveEnabled').checked = config.auto_approve_enabled === 1;
|
||||
document.getElementById('autoApproveHourlyLimit').value = config.auto_approve_hourly_limit || 10;
|
||||
document.getElementById('autoApproveVipDays').value = config.auto_approve_vip_days || 7;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载系统配置失败:', error);
|
||||
@@ -1471,6 +1512,43 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function saveAutoApproveConfig() {
|
||||
const autoApproveEnabled = document.getElementById('autoApproveEnabled').checked ? 1 : 0;
|
||||
const autoApproveHourlyLimit = parseInt(document.getElementById('autoApproveHourlyLimit').value) || 10;
|
||||
const autoApproveVipDays = parseInt(document.getElementById('autoApproveVipDays').value) || 0;
|
||||
|
||||
if (autoApproveHourlyLimit < 1) {
|
||||
alert('❌ 每小时注册限制必须大于0');
|
||||
return;
|
||||
}
|
||||
|
||||
if (autoApproveVipDays < 0) {
|
||||
alert('❌ VIP天数不能为负数');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch('/yuyx/api/system/config', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
auto_approve_enabled: autoApproveEnabled,
|
||||
auto_approve_hourly_limit: autoApproveHourlyLimit,
|
||||
auto_approve_vip_days: autoApproveVipDays
|
||||
})
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
if (data.message) {
|
||||
showNotification('✓ 自动审核配置已保存', 'success');
|
||||
} else if (data.error) {
|
||||
showNotification('✗ ' + data.error, 'error');
|
||||
}
|
||||
} catch (error) {
|
||||
showNotification('保存失败: ' + error.message, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
async function testProxy() {
|
||||
const apiUrl = document.getElementById('proxyApiUrl').value.trim();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user