diff --git a/aurora-springboot/src/main/java/com/aurora/constant/RedisPrefixConstant.java b/aurora-springboot/src/main/java/com/aurora/constant/RedisPrefixConstant.java index 90b5d68..3ef9db8 100644 --- a/aurora-springboot/src/main/java/com/aurora/constant/RedisPrefixConstant.java +++ b/aurora-springboot/src/main/java/com/aurora/constant/RedisPrefixConstant.java @@ -22,6 +22,6 @@ public class RedisPrefixConstant { public static final String LOGIN_USER = "login_user"; - public static final String USER_ARTICLE_ACCESS = "article_access"; + public static final String ARTICLE_ACCESS = "article_access"; } diff --git a/aurora-springboot/src/main/java/com/aurora/controller/ArticleController.java b/aurora-springboot/src/main/java/com/aurora/controller/ArticleController.java index f002e80..f79ea68 100644 --- a/aurora-springboot/src/main/java/com/aurora/controller/ArticleController.java +++ b/aurora-springboot/src/main/java/com/aurora/controller/ArticleController.java @@ -52,8 +52,8 @@ public class ArticleController { } @ApiOperation("根据id获取文章") - @GetMapping("/articles/{id}") - public ResultVO getArticleById(@PathVariable("id") Integer articleId) { + @GetMapping("/articles/{articleId}") + public ResultVO getArticleById(@PathVariable("articleId") Integer articleId) { return ResultVO.ok(articleService.getArticleById(articleId)); } diff --git a/aurora-springboot/src/main/java/com/aurora/service/impl/ArticleServiceImpl.java b/aurora-springboot/src/main/java/com/aurora/service/impl/ArticleServiceImpl.java index f77d4be..1672820 100644 --- a/aurora-springboot/src/main/java/com/aurora/service/impl/ArticleServiceImpl.java +++ b/aurora-springboot/src/main/java/com/aurora/service/impl/ArticleServiceImpl.java @@ -123,7 +123,7 @@ public class ArticleServiceImpl extends ServiceImpl impl if (articleForCheck.getStatus().equals(2)) { Boolean isAccess; try { - isAccess = redisService.sIsMember(USER_ARTICLE_ACCESS + ":" + UserUtil.getUserDetailsDTO().getId(), articleId); + isAccess = redisService.sIsMember(ARTICLE_ACCESS + ":" + UserUtil.getUserDetailsDTO().getId(), articleId); } catch (Exception exception) { throw new BizException(ARTICLE_ACCESS_FAIL); } @@ -167,7 +167,7 @@ public class ArticleServiceImpl extends ServiceImpl impl throw new BizException("文章不存在"); } if (article.getPassword().equals(articlePasswordVO.getArticlePassword())) { - redisService.sAdd(USER_ARTICLE_ACCESS + ":" + UserUtil.getUserDetailsDTO().getId(), articlePasswordVO.getArticleId()); + redisService.sAdd(ARTICLE_ACCESS + ":" + UserUtil.getUserDetailsDTO().getId(), articlePasswordVO.getArticleId()); } else { throw new BizException("密码错误"); }