From e4756cc36c80978639bda6e06c7addd2fdf949e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E8=8B=B1=E6=9D=B0?= <327782001@qq.com> Date: Tue, 24 Oct 2023 18:11:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E9=9A=8F=E6=9C=BA=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CsdnController.java | 6 ---- .../springbootkwan/schedule/CsdnSchedule.java | 7 ---- .../springbootkwan/service/CsdnService.java | 5 --- .../service/impl/CsdnServiceImpl.java | 35 ------------------- 4 files changed, 53 deletions(-) diff --git a/src/main/java/com/kwan/springbootkwan/controller/CsdnController.java b/src/main/java/com/kwan/springbootkwan/controller/CsdnController.java index 838eb33..59eadb6 100644 --- a/src/main/java/com/kwan/springbootkwan/controller/CsdnController.java +++ b/src/main/java/com/kwan/springbootkwan/controller/CsdnController.java @@ -41,10 +41,4 @@ public class CsdnController { csdnService.multiTriplet(); return Result.ok("多人三连完成"); } - - @GetMapping("/multiComment") - public Result multiComment() { - csdnService.multiComment(); - return Result.ok("多人评论完成"); - } } diff --git a/src/main/java/com/kwan/springbootkwan/schedule/CsdnSchedule.java b/src/main/java/com/kwan/springbootkwan/schedule/CsdnSchedule.java index 233eb54..cc7b28f 100644 --- a/src/main/java/com/kwan/springbootkwan/schedule/CsdnSchedule.java +++ b/src/main/java/com/kwan/springbootkwan/schedule/CsdnSchedule.java @@ -21,12 +21,5 @@ public class CsdnSchedule { csdnService.multiTriplet(); log.info("Scheduled task is finish ... ..."); } - - @Scheduled(cron = "0 0/30 * * * ?") - public void executeMultiComment() { - log.info("Scheduled task is running ... ..."); - csdnService.multiComment(); - log.info("Scheduled task is finish ... ..."); - } } diff --git a/src/main/java/com/kwan/springbootkwan/service/CsdnService.java b/src/main/java/com/kwan/springbootkwan/service/CsdnService.java index 313f59e..88930e4 100644 --- a/src/main/java/com/kwan/springbootkwan/service/CsdnService.java +++ b/src/main/java/com/kwan/springbootkwan/service/CsdnService.java @@ -20,9 +20,4 @@ public interface CsdnService { * 多人三连 */ void multiTriplet(); - - /** - * 多人只评论 - */ - void multiComment(); } \ No newline at end of file diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnServiceImpl.java index 6c55434..85ee567 100644 --- a/src/main/java/com/kwan/springbootkwan/service/impl/CsdnServiceImpl.java +++ b/src/main/java/com/kwan/springbootkwan/service/impl/CsdnServiceImpl.java @@ -125,39 +125,4 @@ public class CsdnServiceImpl implements CsdnService { // } // log.info("全部三连完成"); // } - - - @Override - public void multiComment() { - final List userNames = csdnUserInfoService.list(); - if (CollectionUtil.isNotEmpty(userNames)) { - for (CsdnUserInfo csdnUserInfo : userNames) { - final String userName = csdnUserInfo.getUserName(); - try { - Thread.sleep(10000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - List list = this.getArticles(userName); - if (list == null) { - continue; - } - for (int i = 0; i < numOfArticlesPerPerson; i++) { - final BusinessInfoResponse.ArticleData.Article article = list.get(i); - final String type = article.getType(); - if (!StringUtils.equals("blog", type)) { - continue; - } - final String urlInfo = article.getUrl(); - String articleId = urlInfo.substring(urlInfo.lastIndexOf("/") + 1); - //评论 - final Boolean comment = csdnCommentService.isComment(article); - if (!comment) { - csdnCommentService.comment(articleId); - } - } - } - } - log.info("多人只评论完成"); - } } \ No newline at end of file -- GitLab