🐛 文章推送百度搜索问题修复
This commit is contained in:
parent
3189b59192
commit
33395df3e6
@ -114,6 +114,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
|||||||
map.put("message", "正文不能为空!");
|
map.put("message", "正文不能为空!");
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
boolean isUpdate = false;
|
||||||
String articleTitle = article.getArticleTitle();
|
String articleTitle = article.getArticleTitle();
|
||||||
String articleTags = article.getArticleTags();
|
String articleTags = article.getArticleTags();
|
||||||
String articleContent = article.getArticleContent();
|
String articleContent = article.getArticleContent();
|
||||||
@ -141,10 +142,8 @@ 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()) && articleContent.length() >= MAX_PREVIEW) {
|
|
||||||
BaiDuUtils.sendSEOData(newArticle.getArticlePermalink());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
|
isUpdate = true;
|
||||||
newArticle = articleMapper.selectByPrimaryKey(article.getIdArticle());
|
newArticle = articleMapper.selectByPrimaryKey(article.getIdArticle());
|
||||||
if (!user.getIdUser().equals(newArticle.getArticleAuthorId())) {
|
if (!user.getIdUser().equals(newArticle.getArticleAuthorId())) {
|
||||||
map.put("message", "非法访问!");
|
map.put("message", "非法访问!");
|
||||||
@ -155,9 +154,6 @@ 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()) && articleContent.length() >= MAX_PREVIEW) {
|
|
||||||
BaiDuUtils.sendUpdateSEOData(newArticle.getArticlePermalink());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notification && defaultStatus.equals(newArticle.getArticleStatus())) {
|
if (notification && defaultStatus.equals(newArticle.getArticleStatus())) {
|
||||||
@ -184,6 +180,17 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
|||||||
}
|
}
|
||||||
articleMapper.updateByPrimaryKeySelective(newArticle);
|
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());
|
map.put("id", newArticle.getIdArticle());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user