From c8669805762942f1785ab548e54d898dd07f43ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E8=8B=B1=E6=9D=B0?= <327782001@qq.com> Date: Thu, 26 Oct 2023 12:39:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kwan/springbootkwan/entity/resp/CollectResponse.java | 2 +- .../service/impl/CsdnCollectServiceImpl.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/kwan/springbootkwan/entity/resp/CollectResponse.java b/src/main/java/com/kwan/springbootkwan/entity/resp/CollectResponse.java index 04f8936..be5ea2c 100644 --- a/src/main/java/com/kwan/springbootkwan/entity/resp/CollectResponse.java +++ b/src/main/java/com/kwan/springbootkwan/entity/resp/CollectResponse.java @@ -4,7 +4,7 @@ import lombok.Data; @Data public class CollectResponse { - public Long code; + public int code; public String msg; public String total; public Object data; diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCollectServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCollectServiceImpl.java index 60b9986..3b9053d 100644 --- a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCollectServiceImpl.java +++ b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnCollectServiceImpl.java @@ -100,14 +100,14 @@ public class CsdnCollectServiceImpl implements CsdnCollectService { } catch (JsonProcessingException e) { e.printStackTrace(); } - final Long code = collectResponse.code; - if (code.equals(200)) { + final int code = collectResponse.code; + if (code == 200) { log.info("文章{}收藏成功", articleId); csdnUserInfo.setCollectStatus(CollectStatus.COLLECT_SUCCESSFUL.getCode()); - } else if (code.equals(400000101)) { + } else if (code == 400000101) { log.info("收藏文章{}参数缺失", articleId); csdnUserInfo.setCollectStatus(CollectStatus.MISSING_PARAMETER.getCode()); - } else if (code.equals(400)) { + } else if (code == 400) { log.info("今日收藏次数已达上限!"); csdnUserInfo.setCollectStatus(CollectStatus.COLLECT_IS_FULL.getCode()); } else { -- GitLab