refactor(auth): 精简放行白名单并移除举报类型校验
- 仅保留必要匿名接口,清理历史 demo 与业务无关路径 - 合并 CORS 配置,保持跨域设置不变 - AI 举报接口改为仅校验角色存在,不再校验类型范围,简化逻辑 - 商品实体与 VO 新增 level 字段
This commit is contained in:
@@ -57,67 +57,16 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
|||||||
"/swagger-ui/**",
|
"/swagger-ui/**",
|
||||||
"/favicon.ico",
|
"/favicon.ico",
|
||||||
// 你的其他放行路径,例如登录接口
|
// 你的其他放行路径,例如登录接口
|
||||||
"/demo/test",
|
|
||||||
"/error",
|
"/error",
|
||||||
"/demo/talk",
|
|
||||||
"/user/appleLogin",
|
"/user/appleLogin",
|
||||||
"/demo/embed",
|
|
||||||
"/demo/testSaveEmbed",
|
|
||||||
"/demo/testSearch",
|
|
||||||
"/demo/testSearchText",
|
|
||||||
"/file/upload",
|
|
||||||
"/user/logout",
|
"/user/logout",
|
||||||
"/tag/list",
|
"/tag/list",
|
||||||
"/character/detail",
|
"/character/detail",
|
||||||
"/user/login",
|
"/user/login",
|
||||||
"/character/listByUser",
|
|
||||||
"/user/detail",
|
|
||||||
"/user/register",
|
|
||||||
"/user/updateInfo",
|
|
||||||
"/character/updateUserCharacterSort",
|
|
||||||
"/character/delUserCharacter",
|
|
||||||
"/user/sendVerifyMail",
|
|
||||||
"/user/verifyMailCode",
|
"/user/verifyMailCode",
|
||||||
"/character/listWithNotLogin",
|
"/character/listWithNotLogin",
|
||||||
"/character/listByTagWithNotLogin",
|
"/character/listByTagWithNotLogin",
|
||||||
"/character/listByTag",
|
"/ai-companion/report"
|
||||||
"/character/detailWithNotLogin",
|
|
||||||
"/character/addUserCharacter",
|
|
||||||
"/character/list",
|
|
||||||
"/user/resetPassWord",
|
|
||||||
"/chat/talk",
|
|
||||||
"/chat/save_embed",
|
|
||||||
"/themes/listByStyle",
|
|
||||||
"/wallet/balance",
|
|
||||||
"/themes/purchase",
|
|
||||||
"/themes/purchased",
|
|
||||||
"/themes/purchase/list",
|
|
||||||
"/themes/detail",
|
|
||||||
"/themes/recommended",
|
|
||||||
"/themes/search",
|
|
||||||
"/user-themes/batch-delete",
|
|
||||||
"/products/listByType",
|
|
||||||
"/products/detail",
|
|
||||||
"/products/inApp/list",
|
|
||||||
"/products/subscription/list",
|
|
||||||
"/purchase/handle",
|
|
||||||
"/apple/notification",
|
|
||||||
"/apple/receipt",
|
|
||||||
"/apple/validate-receipt",
|
|
||||||
"/user/inviteCode",
|
|
||||||
"/user/bindInviteCode",
|
|
||||||
"/themes/listAllStyles",
|
|
||||||
"/wallet/transactions",
|
|
||||||
"/themes/restore",
|
|
||||||
"/chat/message",
|
|
||||||
"/chat/voice",
|
|
||||||
"/chat/audio/*",
|
|
||||||
"/ai-companion/page",
|
|
||||||
"/chat/history",
|
|
||||||
"/ai-companion/comment/add",
|
|
||||||
"/speech/transcribe",
|
|
||||||
"/ai-companion/comment/page",
|
|
||||||
"/ai-companion/liked"
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
@@ -108,4 +108,8 @@ public class KeyboardProductItems {
|
|||||||
@TableField(value = "duration_days")
|
@TableField(value = "duration_days")
|
||||||
@Schema(description="订阅时长的具体天数")
|
@Schema(description="订阅时长的具体天数")
|
||||||
private Integer durationDays;
|
private Integer durationDays;
|
||||||
|
|
||||||
|
@TableField(value = "level")
|
||||||
|
@Schema(description = "级别")
|
||||||
|
private Integer level;
|
||||||
}
|
}
|
||||||
@@ -44,5 +44,7 @@ public class KeyboardProductItemRespVO {
|
|||||||
@Schema(description = "描述")
|
@Schema(description = "描述")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "级别")
|
||||||
|
private Integer level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,14 +38,6 @@ public class KeyboardAiCompanionReportServiceImpl extends ServiceImpl<KeyboardAi
|
|||||||
throw new BusinessException(ErrorCode.REPORT_TYPE_EMPTY);
|
throw new BusinessException(ErrorCode.REPORT_TYPE_EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验每个 reportType 在有效范围内(1,2,3,4,5,99)
|
|
||||||
List<Short> validTypes = List.of((short) 1, (short) 2, (short) 3, (short) 4, (short) 5, (short) 99);
|
|
||||||
for (Short type : req.getReportTypes()) {
|
|
||||||
if (!validTypes.contains(type)) {
|
|
||||||
throw new BusinessException(ErrorCode.REPORT_TYPE_INVALID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 校验 AI 角色是否存在
|
// 校验 AI 角色是否存在
|
||||||
KeyboardAiCompanion companion = aiCompanionService.getById(req.getCompanionId());
|
KeyboardAiCompanion companion = aiCompanionService.getById(req.getCompanionId());
|
||||||
if (companion == null) {
|
if (companion == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user