diff --git a/web/src/views/RiskRules.vue b/web/src/views/RiskRules.vue index 880906d..fdad20b 100644 --- a/web/src/views/RiskRules.vue +++ b/web/src/views/RiskRules.vue @@ -62,7 +62,7 @@
- {{ p.name }} + {{ p.name }} {{ typeLabel(p.type) }}
@@ -75,7 +75,7 @@
- - - - {{ x.label }} - - - + - +
#{{ idx + 1 }} @@ -120,7 +114,7 @@ {{ applicableHint(rule.applicable) }}
- +
触发条件 当 @@ -133,7 +127,7 @@ → - {{ actionText(rule.action) }} + 封号
@@ -151,7 +145,7 @@

规则体系:等级豁免 → 账号存活 → 流量监控 → H&R 惩罚 → 分享率检查

-

满足豁免条件的用户不受任何规则影响。导入后可调整参数和操作类型(封号/告警)。

+

满足豁免条件的用户不受任何规则影响。系统会自动根据风险百分比触发告警(riskPct > 80%)。

{{ cat.title }}
@@ -161,7 +155,7 @@ {{ p.name }} - {{ actionText(p.action) }} + 封号 {{ presetDesc(p) }}
@@ -180,10 +174,6 @@ import { Plus, ArrowDown, ArrowUp, Rank, Delete } from '@element-plus/icons-vue' import api from '../api' // ============ 选项配置 ============ -const actionOptions = [ - { value: 'KILL', label: '封号' }, - { value: 'WARN', label: '告警' }, -] const typeOptions = [ { value: 'KILL', label: '封号规则' }, { value: 'TRAFFIC', label: '流量监控' }, @@ -217,34 +207,24 @@ const metricOptions = [ ] const typeLabel = (t) => typeOptions.find(x => x.value === t)?.label || t -const actionColor = (a) => ({ KILL: '#f56c6c', WARN: '#e6a23c' }[a] || '#909399') -const actionText = (a) => ({ KILL: '封号', WARN: '告警' }[a] || a) const applicableHint = (a) => { const m = { '!sealed':'未封存用户', 'sealed':'已封存用户', 'zero_traffic':'上传/下载均为 0', 'new_account_30d':'从未完成种子且无流量增量' } return a ? `— ${m[a] || ''}` : '' } // ============ 预设规则模板 ============ -// 每条模板包含 type(监控类型)+ action(KILL/WARN 操作)+ 触发条件 const presets = [ // 四、账号存活策略 - { name:'未封存不登录封号', type:'KILL', action:'KILL', metric:'days_since_last_login', threshold:150, unit:'天', condition:'GT', applicable:'!sealed', description:'未封存账号连续150天不登录即封号' }, - { name:'封存账号不登录封号', type:'KILL', action:'KILL', metric:'days_since_last_login', threshold:365, unit:'天', condition:'GT', applicable:'sealed', description:'封存账号连续365天不登录即封号' }, - { name:'零流量账号清理', type:'KILL', action:'KILL', metric:'days_since_last_login', threshold:30, unit:'天', condition:'GT', applicable:'zero_traffic', description:'零流量用户连续30天不登录即封号' }, + { name:'未封存不登录封号', type:'KILL', metric:'days_since_last_login', threshold:150, unit:'天', condition:'GT', applicable:'!sealed', description:'未封存账号连续150天不登录即封号' }, + { name:'封存账号不登录封号', type:'KILL', metric:'days_since_last_login', threshold:365, unit:'天', condition:'GT', applicable:'sealed', description:'封存账号连续365天不登录即封号' }, + { name:'零流量账号清理', type:'KILL', metric:'days_since_last_login', threshold:30, unit:'天', condition:'GT', applicable:'zero_traffic', description:'零流量用户连续30天不登录即封号' }, // 五、零活跃新用户清理 - { name:'零活跃不登录封号', type:'KILL', action:'KILL', metric:'days_since_last_login', threshold:7, unit:'天', condition:'GT', applicable:'new_account_30d', description:'零活跃新用户连续7天不登录即封号' }, - { name:'零活跃注册天数封号', type:'KILL', action:'KILL', metric:'days_since_registration', threshold:30, unit:'天', condition:'GT', applicable:'new_account_30d', description:'零活跃新用户注册满30天即封号' }, + { name:'零活跃不登录封号', type:'KILL', metric:'days_since_last_login', threshold:7, unit:'天', condition:'GT', applicable:'new_account_30d', description:'零活跃新用户连续7天不登录即封号' }, + { name:'零活跃注册天数封号', type:'KILL', metric:'days_since_registration', threshold:30, unit:'天', condition:'GT', applicable:'new_account_30d', description:'零活跃新用户注册满30天即封号' }, // 流量监控 - { name:'连续无流量封号', type:'TRAFFIC', action:'KILL', metric:'days_since_last_traffic', threshold:90, unit:'天', condition:'GT', description:'连续90天无上传/下载流量即封号' }, - { name:'无流量告警', type:'TRAFFIC', action:'WARN', metric:'days_since_last_traffic', threshold:60, unit:'天', condition:'GT', description:'连续60天无流量时发出告警提醒' }, - // 登录监控 - { name:'长期未登录告警', type:'LOGIN', action:'WARN', metric:'days_since_last_login', threshold:30, unit:'天', condition:'GT', description:'超过30天未登录时发出告警提醒' }, - { name:'即将触发封号提醒', type:'LOGIN', action:'WARN', metric:'days_since_last_login', threshold:140, unit:'天', condition:'GT', applicable:'!sealed', description:'未封存用户即将达到150天封号线时提前告警' }, + { name:'连续无流量封号', type:'TRAFFIC', metric:'days_since_last_traffic', threshold:90, unit:'天', condition:'GT', description:'连续90天无上传/下载流量即封号' }, // H&R - { name:'H&R 封号', type:'HD', action:'KILL', metric:'hnr_count', threshold:5, unit:'次', condition:'GTE', description:'H&R违规次数达到5次即封号' }, - { name:'H&R 告警', type:'HD', action:'WARN', metric:'hnr_count', threshold:3, unit:'次', condition:'GTE', description:'H&R违规次数达到3次发出告警' }, - // 分享率 - { name:'分享率过低告警', type:'RATIO', action:'WARN', metric:'ratio', threshold:1.0, unit:'倍', condition:'LT', description:'分享率低于1.0时发出告警提醒' }, + { name:'H&R 封号', type:'HD', metric:'hnr_count', threshold:5, unit:'次', condition:'GTE', description:'H&R违规次数达到5次即封号' }, ] const presetCategories = [ @@ -252,8 +232,6 @@ const presetCategories = [ { title:'五、零活跃新用户清理', items: presets.filter(p => p.name.includes('零活跃')) }, { title:'流量监控', items: presets.filter(p => p.type === 'TRAFFIC') }, { title:'H&R 惩罚', items: presets.filter(p => p.type === 'HD') }, - { title:'登录提醒', items: presets.filter(p => p.type === 'LOGIN') }, - { title:'分享率监控', items: presets.filter(p => p.type === 'RATIO') }, ] const presetDesc = (p) => { @@ -312,7 +290,7 @@ const sync = () => { editorJson.value = JSON.stringify(parsed.value, null, 2) } const addRule = () => { parsed.value = [...parsed.value, { - type:'KILL', action:'KILL', name:'', metric:'days_since_last_login', threshold:0, unit:'天', condition:'GT', + type:'KILL', name:'', metric:'days_since_last_login', threshold:0, unit:'天', condition:'GT', applicable:null, description:'', _fold:false }] } @@ -365,14 +343,13 @@ onMounted(fetchAll)