主要更新: - 更新代理商端文档,明确项目由品牌方分配流程 - 新增Brief配置详情页(已配置)设计稿 - 完善工作台紧急待办中品牌新任务功能 - 整理Pencil设计文件中代理商端页面顺序 - 新增后端FastAPI框架及核心API - 新增前端Next.js页面和组件库 - 添加.gitignore排除构建和缓存文件 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
"""
|
|
风险分类服务
|
|
根据违规类型判断风险等级
|
|
"""
|
|
from app.schemas.review import ViolationType, RiskLevel
|
|
|
|
|
|
def classify_risk_level(violation_type: ViolationType) -> RiskLevel:
|
|
"""
|
|
根据违规类型分类风险等级
|
|
|
|
规则:
|
|
- 高风险 (HIGH): 法律违规(广告法极限词、功效宣称)
|
|
- 中风险 (MEDIUM): 平台规则违规(竞品露出、时长不足)
|
|
- 低风险 (LOW): 品牌规范违规(品牌提及不足)
|
|
|
|
Args:
|
|
violation_type: 违规类型
|
|
|
|
Returns:
|
|
RiskLevel: 风险等级
|
|
"""
|
|
high_risk_types = {
|
|
ViolationType.FORBIDDEN_WORD,
|
|
ViolationType.EFFICACY_CLAIM,
|
|
}
|
|
|
|
medium_risk_types = {
|
|
ViolationType.COMPETITOR_LOGO,
|
|
ViolationType.DURATION_SHORT,
|
|
ViolationType.BRAND_SAFETY,
|
|
}
|
|
|
|
low_risk_types = {
|
|
ViolationType.MENTION_MISSING,
|
|
}
|
|
|
|
if violation_type in high_risk_types:
|
|
return RiskLevel.HIGH
|
|
elif violation_type in medium_risk_types:
|
|
return RiskLevel.MEDIUM
|
|
elif violation_type in low_risk_types:
|
|
return RiskLevel.LOW
|
|
else:
|
|
# 默认中风险
|
|
return RiskLevel.MEDIUM
|