From 8d3685bb22e52540dd8a0dcbb1e06f2c6dd89baa Mon Sep 17 00:00:00 2001 From: linhaojun Date: Sat, 8 Oct 2022 19:07:31 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/aurora/constant/RedisPrefixConstant.java | 2 +- .../main/java/com/aurora/controller/ArticleController.java | 4 ++-- .../main/java/com/aurora/service/impl/ArticleServiceImpl.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) 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("密码错误"); }