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 04f8936065070a8c1ec9b2500fc622067c525b8e..be5ea2c39b46aa46e7f39927db86dcae8c260325 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 60b9986595f39f70fb8bd5faa44227b241c61d9e..3b9053d8a624f86490486893eee410d5ce5d6050 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 {