From dff2145c0f8450f12e30843ddd083ceaac8f8f51 Mon Sep 17 00:00:00 2001 From: ronger Date: Tue, 14 Dec 2021 10:20:45 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E5=89=94=E9=99=A4=E4=B8=BB=E5=8A=A8?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E7=99=BE=E5=BA=A6=20SEO=20=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ArticleServiceImpl.java | 22 +++---------------- .../com/rymcu/forest/task/BaiDuCronTask.java | 2 +- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java index 7db94a9..4144a04 100644 --- a/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java +++ b/src/main/java/com/rymcu/forest/service/impl/ArticleServiceImpl.java @@ -199,30 +199,14 @@ public class ArticleServiceImpl extends AbstractService
implements Arti } if (StringUtils.isNotBlank(articleContentHtml)) { - String previewContent; - if (articleContentHtml.length() > MAX_PREVIEW) { - previewContent = BaiDuAipUtils.getNewsSummary(newArticle.getArticleTitle(), articleContentHtml, MAX_PREVIEW); - if (previewContent.length() > MAX_PREVIEW) { - previewContent = previewContent.substring(0, MAX_PREVIEW); - } - } else { - previewContent = Html2TextUtil.getContent(articleContentHtml); + String previewContent = Html2TextUtil.getContent(articleContentHtml); + if (previewContent.length() > MAX_PREVIEW) { + previewContent = previewContent.substring(0, MAX_PREVIEW); } newArticle.setArticlePreviewContent(previewContent); } articleMapper.updateByPrimaryKeySelective(newArticle); - // 推送百度 SEO - if (!ProjectConstant.ENV.equals(env) - && defaultStatus.equals(newArticle.getArticleStatus()) - && articleContent.length() >= MAX_PREVIEW) { - if (isUpdate) { - BaiDuUtils.sendUpdateSEOData(newArticle.getArticlePermalink()); - } else { - BaiDuUtils.sendSEOData(newArticle.getArticlePermalink()); - } - } - map.put("id", newArticle.getIdArticle()); return map; } diff --git a/src/main/java/com/rymcu/forest/task/BaiDuCronTask.java b/src/main/java/com/rymcu/forest/task/BaiDuCronTask.java index 097d7ff..6872773 100644 --- a/src/main/java/com/rymcu/forest/task/BaiDuCronTask.java +++ b/src/main/java/com/rymcu/forest/task/BaiDuCronTask.java @@ -10,7 +10,7 @@ import org.springframework.stereotype.Component; /** * @author ronger */ -@Component +//@Component @Slf4j public class BaiDuCronTask {