|
@@ -72,7 +72,7 @@ public class DataForSEOService {
|
|
|
|
|
|
@Autowired private ISeoKeywordsSerpService seoKeywordsSerpService;
|
|
@Autowired private ISeoKeywordsSerpService seoKeywordsSerpService;
|
|
|
|
|
|
- @Autowired private AdwebRedisUtil redisUtil;
|
|
|
|
|
|
+ @Autowired private AdwebRedisUtil adwebRedisUtil;
|
|
|
|
|
|
private SerpApi serpApi;
|
|
private SerpApi serpApi;
|
|
|
|
|
|
@@ -117,7 +117,7 @@ public class DataForSEOService {
|
|
|
|
|
|
/** 同步DataForSEO Serp结果 - 从Redis中获取正在运行的任务 */
|
|
/** 同步DataForSEO Serp结果 - 从Redis中获取正在运行的任务 */
|
|
public void syncKeywordsSerpResults() {
|
|
public void syncKeywordsSerpResults() {
|
|
- Set<String> serpTaskRedisKeys = redisUtil.keys(this.getSerpTaskRedisKey("*"));
|
|
|
|
|
|
+ Set<String> serpTaskRedisKeys = adwebRedisUtil.keys(this.getSerpTaskRedisKey("*"));
|
|
|
|
|
|
if (CollectionUtil.isEmpty(serpTaskRedisKeys)) {
|
|
if (CollectionUtil.isEmpty(serpTaskRedisKeys)) {
|
|
log.info("Redis中暂无需要同步的Serp关键词");
|
|
log.info("Redis中暂无需要同步的Serp关键词");
|
|
@@ -174,7 +174,7 @@ public class DataForSEOService {
|
|
for (SerpGoogleOrganicTaskPostTaskInfo serpingTask : serpingTasks) {
|
|
for (SerpGoogleOrganicTaskPostTaskInfo serpingTask : serpingTasks) {
|
|
Map<String, String> data = (Map<String, String>) serpingTask.getData();
|
|
Map<String, String> data = (Map<String, String>) serpingTask.getData();
|
|
String keywordId = data.get("tag");
|
|
String keywordId = data.get("tag");
|
|
- redisUtil.set(this.getSerpTaskRedisKey(keywordId), serpingTask.getId());
|
|
|
|
|
|
+ adwebRedisUtil.set(this.getSerpTaskRedisKey(keywordId), serpingTask.getId());
|
|
|
|
|
|
serpingKeywordIds.add(Integer.parseInt(keywordId));
|
|
serpingKeywordIds.add(Integer.parseInt(keywordId));
|
|
}
|
|
}
|
|
@@ -212,7 +212,7 @@ public class DataForSEOService {
|
|
private boolean onSerpResult(String serpTaskRedisKey) {
|
|
private boolean onSerpResult(String serpTaskRedisKey) {
|
|
try {
|
|
try {
|
|
// 1. 查询Serp task
|
|
// 1. 查询Serp task
|
|
- String taskId = redisUtil.getString(serpTaskRedisKey);
|
|
|
|
|
|
+ String taskId = adwebRedisUtil.getString(serpTaskRedisKey);
|
|
SerpGoogleOrganicTaskGetRegularTaskInfo serpTask =
|
|
SerpGoogleOrganicTaskGetRegularTaskInfo serpTask =
|
|
serpApi.googleOrganicTaskGetRegular(taskId).getTasks().get(0);
|
|
serpApi.googleOrganicTaskGetRegular(taskId).getTasks().get(0);
|
|
log.info("获取DataForSEO Serp任务,response = {}", FastJsonUtil.toJSONString(serpTask));
|
|
log.info("获取DataForSEO Serp任务,response = {}", FastJsonUtil.toJSONString(serpTask));
|
|
@@ -237,7 +237,7 @@ public class DataForSEOService {
|
|
if (Objects.isNull(seoKeyword)) {
|
|
if (Objects.isNull(seoKeyword)) {
|
|
log.info("无法获取关键词 ID = {}", keywordId);
|
|
log.info("无法获取关键词 ID = {}", keywordId);
|
|
|
|
|
|
- redisUtil.del(serpTaskRedisKey);
|
|
|
|
|
|
+ adwebRedisUtil.del(serpTaskRedisKey);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -299,7 +299,7 @@ public class DataForSEOService {
|
|
keywordSerp.setSeDatetime(seDatetime);
|
|
keywordSerp.setSeDatetime(seDatetime);
|
|
seoKeywordsSerpService.save(keywordSerp);
|
|
seoKeywordsSerpService.save(keywordSerp);
|
|
|
|
|
|
- redisUtil.del(serpTaskRedisKey);
|
|
|
|
|
|
+ adwebRedisUtil.del(serpTaskRedisKey);
|
|
return true;
|
|
return true;
|
|
} catch (ApiException e) {
|
|
} catch (ApiException e) {
|
|
log.error("同步DataForSEO Serp任务失败", e);
|
|
log.error("同步DataForSEO Serp任务失败", e);
|