fix:随机评论

上级 29d29b87
...@@ -41,10 +41,4 @@ public class CsdnController { ...@@ -41,10 +41,4 @@ public class CsdnController {
csdnService.multiTriplet(); csdnService.multiTriplet();
return Result.ok("多人三连完成"); return Result.ok("多人三连完成");
} }
@GetMapping("/multiComment")
public Result multiComment() {
csdnService.multiComment();
return Result.ok("多人评论完成");
}
} }
...@@ -21,12 +21,5 @@ public class CsdnSchedule { ...@@ -21,12 +21,5 @@ public class CsdnSchedule {
csdnService.multiTriplet(); csdnService.multiTriplet();
log.info("Scheduled task is finish ... ..."); 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 ... ...");
}
} }
...@@ -20,9 +20,4 @@ public interface CsdnService { ...@@ -20,9 +20,4 @@ public interface CsdnService {
* 多人三连 * 多人三连
*/ */
void multiTriplet(); void multiTriplet();
/**
* 多人只评论
*/
void multiComment();
} }
\ No newline at end of file
...@@ -125,39 +125,4 @@ public class CsdnServiceImpl implements CsdnService { ...@@ -125,39 +125,4 @@ public class CsdnServiceImpl implements CsdnService {
// } // }
// log.info("全部三连完成"); // log.info("全部三连完成");
// } // }
@Override
public void multiComment() {
final List<CsdnUserInfo> 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<BusinessInfoResponse.ArticleData.Article> 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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册