🔍 改善 SEO 提交/更新机制

This commit is contained in:
ronger 2020-08-14 15:52:11 +08:00
parent d6b5157934
commit 488b0f6107

View File

@ -141,7 +141,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
newArticle.setArticleStatus(article.getArticleStatus()); newArticle.setArticleStatus(article.getArticleStatus());
articleMapper.insertSelective(newArticle); articleMapper.insertSelective(newArticle);
articleMapper.insertArticleContent(newArticle.getIdArticle(), articleContent, articleContentHtml); articleMapper.insertArticleContent(newArticle.getIdArticle(), articleContent, articleContentHtml);
if (!ProjectConstant.ENV.equals(env) && defaultStatus.equals(newArticle.getArticleStatus())) { if (!ProjectConstant.ENV.equals(env) && defaultStatus.equals(newArticle.getArticleStatus()) && articleContent.length() > MAX_PREVIEW * 3) {
BaiDuUtils.sendSEOData(newArticle.getArticlePermalink()); BaiDuUtils.sendSEOData(newArticle.getArticlePermalink());
} }
} else { } else {
@ -155,7 +155,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
newArticle.setArticleStatus(article.getArticleStatus()); newArticle.setArticleStatus(article.getArticleStatus());
newArticle.setUpdatedTime(new Date()); newArticle.setUpdatedTime(new Date());
articleMapper.updateArticleContent(newArticle.getIdArticle(), articleContent, articleContentHtml); articleMapper.updateArticleContent(newArticle.getIdArticle(), articleContent, articleContentHtml);
if (!ProjectConstant.ENV.equals(env) && defaultStatus.equals(newArticle.getArticleStatus())) { if (!ProjectConstant.ENV.equals(env) && defaultStatus.equals(newArticle.getArticleStatus()) && articleContent.length() > MAX_PREVIEW * 3) {
BaiDuUtils.sendUpdateSEOData(newArticle.getArticlePermalink()); BaiDuUtils.sendUpdateSEOData(newArticle.getArticlePermalink());
} }
} }