diff --git a/src/main/java/com/rymcu/vertical/service/impl/ArticleServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/ArticleServiceImpl.java index 802c65a..a35cfdd 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/ArticleServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/ArticleServiceImpl.java @@ -161,7 +161,7 @@ public class ArticleServiceImpl extends AbstractService
implements Arti newArticle.setUpdatedTime(new Date()); articleMapper.updateArticleContent(newArticle.getIdArticle(),articleContent,articleContentHtml); if (!ProjectConstant.ENV.equals(env) && defaultStatus.equals(newArticle.getArticleStatus())) { - BaiDuUtils.updateSEOData(newArticle.getArticlePermalink()); + BaiDuUtils.sendUpdateSEOData(newArticle.getArticlePermalink()); } } diff --git a/src/main/java/com/rymcu/vertical/task/BaiduCronTask.java b/src/main/java/com/rymcu/vertical/task/BaiDuCronTask.java similarity index 89% rename from src/main/java/com/rymcu/vertical/task/BaiduCronTask.java rename to src/main/java/com/rymcu/vertical/task/BaiDuCronTask.java index 1094982..36b8f89 100644 --- a/src/main/java/com/rymcu/vertical/task/BaiduCronTask.java +++ b/src/main/java/com/rymcu/vertical/task/BaiDuCronTask.java @@ -12,7 +12,7 @@ import org.springframework.stereotype.Component; */ @Component @Slf4j -public class BaiduCronTask { +public class BaiDuCronTask { @Value("${resource.domain}") private String domain; @@ -25,7 +25,7 @@ public class BaiduCronTask { @Scheduled(cron = "0 0 10,14,18 * * ?") public void pushHome() { if (!ProjectConstant.ENV.equals(env)) { - BaiDuUtils.updateSEOData(domain); + BaiDuUtils.sendUpdateSEOData(domain); } } diff --git a/src/main/java/com/rymcu/vertical/util/BaiDuUtils.java b/src/main/java/com/rymcu/vertical/util/BaiDuUtils.java index ec6ce89..9dd5239 100644 --- a/src/main/java/com/rymcu/vertical/util/BaiDuUtils.java +++ b/src/main/java/com/rymcu/vertical/util/BaiDuUtils.java @@ -55,28 +55,6 @@ public class BaiDuUtils { } return 0; },executor); - return; - } - - public static void updateSEOData(String permalink) { - if (StringUtils.isBlank(permalink) || StringUtils.isBlank(token)) { - return; - } - ExecutorService executor= new ThreadPoolExecutor(1,1,0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue()); - CompletableFuture.supplyAsync(()-> { - try { - HttpResponse response = HttpRequest.post("http://data.zz.baidu.com/update?site=" + site + "&token=" + token). - header("User-Agent", "curl/7.12.1"). - header("Host", "data.zz.baidu.com"). - header("Content-Type", "text/plain"). - header("Connection", "close").body(permalink.getBytes(), "text/plain").timeout(30000).send(); - response.charset("UTF-8"); - System.out.println(response.bodyText()); - } catch (Exception e){ - e.printStackTrace(); - } - return 0; - },executor); } public static void deleteSEOData(String permalink) {