From cfcd12be0d3b466c129c89355c71aa422184ee12 Mon Sep 17 00:00:00 2001 From: Hanserwei <2628273921@qq.com> Date: Sat, 18 Oct 2025 15:37:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(note):=E4=BF=AE=E5=A4=8D=E7=AC=94=E8=AE=B0?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E7=82=B9=E8=B5=9E=E9=80=BB=E8=BE=91=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 增加布隆过滤器不存在情况的处理逻辑 - 调整笔记未点赞状态的判断条件 -优化异步初始化布隆过滤器的执行流程- 修复状态判断与异常抛出的逻辑错误 --- .../hannote/note/biz/service/impl/NoteServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/han-note-note/han-note-note-biz/src/main/java/com/hanserwei/hannote/note/biz/service/impl/NoteServiceImpl.java b/han-note-note/han-note-note-biz/src/main/java/com/hanserwei/hannote/note/biz/service/impl/NoteServiceImpl.java index 57046c0..76a40c3 100644 --- a/han-note-note/han-note-note-biz/src/main/java/com/hanserwei/hannote/note/biz/service/impl/NoteServiceImpl.java +++ b/han-note-note/han-note-note-biz/src/main/java/com/hanserwei/hannote/note/biz/service/impl/NoteServiceImpl.java @@ -732,6 +732,7 @@ public class NoteServiceImpl extends ServiceImpl implement log.info("==> 【笔记取消点赞】Lua 脚本返回结果: {}", noteUnlikeLuaResultEnum); assert noteUnlikeLuaResultEnum != null; switch (noteUnlikeLuaResultEnum) { + // 布隆过滤器不存在 case NOT_EXIST -> { //笔记不存在 //异步初始化布隆过滤器 @@ -750,7 +751,8 @@ public class NoteServiceImpl extends ServiceImpl implement } }); } - case NOTE_LIKED -> throw new ApiException(ResponseCodeEnum.NOTE_NOT_LIKED); + // 布隆过滤器校验目标笔记未被点赞(判断绝对正确) + case NOTE_NOT_LIKED -> throw new ApiException(ResponseCodeEnum.NOTE_NOT_LIKED); } // 3. 能走到这里,说明布隆过滤器判断已点赞,直接删除 ZSET 中已点赞的笔记 ID