🎨 代码结构及名称变更
This commit is contained in:
parent
e759a836fd
commit
375a1b9246
@ -161,7 +161,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
|||||||
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())) {
|
||||||
BaiDuUtils.updateSEOData(newArticle.getArticlePermalink());
|
BaiDuUtils.sendUpdateSEOData(newArticle.getArticlePermalink());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import org.springframework.stereotype.Component;
|
|||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class BaiduCronTask {
|
public class BaiDuCronTask {
|
||||||
|
|
||||||
@Value("${resource.domain}")
|
@Value("${resource.domain}")
|
||||||
private String domain;
|
private String domain;
|
||||||
@ -25,7 +25,7 @@ public class BaiduCronTask {
|
|||||||
@Scheduled(cron = "0 0 10,14,18 * * ?")
|
@Scheduled(cron = "0 0 10,14,18 * * ?")
|
||||||
public void pushHome() {
|
public void pushHome() {
|
||||||
if (!ProjectConstant.ENV.equals(env)) {
|
if (!ProjectConstant.ENV.equals(env)) {
|
||||||
BaiDuUtils.updateSEOData(domain);
|
BaiDuUtils.sendUpdateSEOData(domain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -55,28 +55,6 @@ public class BaiDuUtils {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
},executor);
|
},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<Runnable>());
|
|
||||||
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) {
|
public static void deleteSEOData(String permalink) {
|
||||||
|
Loading…
Reference in New Issue
Block a user