fix:添加参数

上级 f90bff62
...@@ -4,7 +4,6 @@ import cn.hutool.http.HttpResponse; ...@@ -4,7 +4,6 @@ import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists;
import com.kwan.springbootkwan.entity.resp.BusinessInfoResponse; import com.kwan.springbootkwan.entity.resp.BusinessInfoResponse;
import com.kwan.springbootkwan.entity.resp.CollectInfoQuery; import com.kwan.springbootkwan.entity.resp.CollectInfoQuery;
import com.kwan.springbootkwan.entity.resp.CollectResponse; import com.kwan.springbootkwan.entity.resp.CollectResponse;
...@@ -14,6 +13,8 @@ import lombok.extern.slf4j.Slf4j; ...@@ -14,6 +13,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
@Slf4j @Slf4j
@Service @Service
public class CsdnCollectServiceImpl implements CsdnCollectService { public class CsdnCollectServiceImpl implements CsdnCollectService {
...@@ -52,9 +53,9 @@ public class CsdnCollectServiceImpl implements CsdnCollectService { ...@@ -52,9 +53,9 @@ public class CsdnCollectServiceImpl implements CsdnCollectService {
if (code == 200) { if (code == 200) {
final boolean status = data.status; final boolean status = data.status;
if (status) { if (status) {
log.info("已收藏"); log.info("文章{}已经收藏过", articleId);
} else { } else {
log.info("未收藏"); log.info("文章{}未收藏", articleId);
} }
return status; return status;
} }
...@@ -79,7 +80,7 @@ public class CsdnCollectServiceImpl implements CsdnCollectService { ...@@ -79,7 +80,7 @@ public class CsdnCollectServiceImpl implements CsdnCollectService {
collectInfoQuery.setAuthor(username); collectInfoQuery.setAuthor(username);
collectInfoQuery.setDescription(article.getDescription()); collectInfoQuery.setDescription(article.getDescription());
collectInfoQuery.setSource("blog"); collectInfoQuery.setSource("blog");
collectInfoQuery.setFolderIdList(Lists.newArrayList(selfFolderId)); collectInfoQuery.setFolderIdList(new ArrayList<>(selfFolderId));
collectInfoQuery.setTitle(article.getTitle()); collectInfoQuery.setTitle(article.getTitle());
collectInfoQuery.setUrl(article.getUrl()); collectInfoQuery.setUrl(article.getUrl());
collectInfoQuery.setUsername(selfUserName); collectInfoQuery.setUsername(selfUserName);
...@@ -97,9 +98,9 @@ public class CsdnCollectServiceImpl implements CsdnCollectService { ...@@ -97,9 +98,9 @@ public class CsdnCollectServiceImpl implements CsdnCollectService {
} }
final Long code = collectResponse.code; final Long code = collectResponse.code;
if (code.equals(200)) { if (code.equals(200)) {
log.info("收藏成功"); log.info("文章{}收藏成功", articleId);
} else if (code.equals(400000101)) { } else if (code.equals(400000101)) {
log.info("参数缺失"); log.info("收藏文章{}参数缺失", articleId);
} else if (code.equals(400)) { } else if (code.equals(400)) {
COLLECT_IS_FULL = true; COLLECT_IS_FULL = true;
log.info("今日收藏次数已达上限!"); log.info("今日收藏次数已达上限!");
......
...@@ -29,7 +29,7 @@ public class CsdnCommentServiceImpl implements CsdnCommentService { ...@@ -29,7 +29,7 @@ public class CsdnCommentServiceImpl implements CsdnCommentService {
@Value("${csdn.url.comment_url}") @Value("${csdn.url.comment_url}")
private String commentUrl; private String commentUrl;
/** /**
* 收藏满了 * 评论满了
*/ */
private static boolean COMMENT_IS_FULL = false; private static boolean COMMENT_IS_FULL = false;
...@@ -62,7 +62,7 @@ public class CsdnCommentServiceImpl implements CsdnCommentService { ...@@ -62,7 +62,7 @@ public class CsdnCommentServiceImpl implements CsdnCommentService {
final String userName = info.getUserName(); final String userName = info.getUserName();
if (StringUtils.equals(userName, selfUserName)) { if (StringUtils.equals(userName, selfUserName)) {
//评论过 //评论过
log.info("文章已经评论过"); log.info("文章{}已经评论过", articleId);
return true; return true;
} }
} }
...@@ -83,7 +83,7 @@ public class CsdnCommentServiceImpl implements CsdnCommentService { ...@@ -83,7 +83,7 @@ public class CsdnCommentServiceImpl implements CsdnCommentService {
final int code = comment.code; final int code = comment.code;
final String message = comment.getMessage(); final String message = comment.getMessage();
if (code == 200) { if (code == 200) {
log.info("评论成功"); log.info("文章{}评论成功", articleId);
} else if (code == 400 && StringUtils.equals(message, "您已达到当日发送上限,请明天尝试!")) { } else if (code == 400 && StringUtils.equals(message, "您已达到当日发送上限,请明天尝试!")) {
log.info(message); log.info(message);
COMMENT_IS_FULL = true; COMMENT_IS_FULL = true;
...@@ -106,6 +106,7 @@ public class CsdnCommentServiceImpl implements CsdnCommentService { ...@@ -106,6 +106,7 @@ public class CsdnCommentServiceImpl implements CsdnCommentService {
.form("content", "支持博主优质文章,讲解得非常详细,干货满满,通俗易懂,期待博主下次更新") .form("content", "支持博主优质文章,讲解得非常详细,干货满满,通俗易懂,期待博主下次更新")
.execute(); .execute();
final String body = response.body(); final String body = response.body();
log.info(body);
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
CommentResponse commentResponse = null; CommentResponse commentResponse = null;
try { try {
......
...@@ -45,9 +45,9 @@ public class CsdnLikeServiceImpl implements CsdnLikeService { ...@@ -45,9 +45,9 @@ public class CsdnLikeServiceImpl implements CsdnLikeService {
if (code == 200) { if (code == 200) {
final boolean status = data.status; final boolean status = data.status;
if (status) { if (status) {
log.info("点赞成功"); log.info("文章{}点赞成功", articleId);
} else { } else {
log.info("点赞取消"); log.info("文章{}点赞取消", articleId);
} }
return status; return status;
} else if (code == 400) { } else if (code == 400) {
......
package com.kwan.springbootkwan.service.impl; package com.kwan.springbootkwan.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kwan.springbootkwan.mapper.CsdnUserInfoMapper;
import com.kwan.springbootkwan.entity.CsdnUserInfo; import com.kwan.springbootkwan.entity.CsdnUserInfo;
import com.kwan.springbootkwan.mapper.CsdnUserInfoMapper;
import com.kwan.springbootkwan.service.CsdnUserInfoService; import com.kwan.springbootkwan.service.CsdnUserInfoService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册