public void Add(TaskGroup_GetSimilarKeywords_OneData d) { if (data != null) { data.Add(d); } }
public override object OneTask_Do(object data) { if (data == null || !(data is string)) { return(null); } string strBaseKeyword = (string)data; string strUA = GlobalVar.Instance.uaList.GetUA(globalSetting.UAType); TaskGroup_GetSimilarKeywords_Data list = new TaskGroup_GetSimilarKeywords_Data(); //GlobalVar.Instance.logger.Debug("DO BEGIN"); if (this.setting.IsUseBaiduSearch) { List <string> result = BaiduSearch(strBaseKeyword, strUA); result = result.Distinct().ToList(); if (result != null && result.Count > 0) { list.Status = TaskStatus.eTaskStatus_Finish_Suceessed; foreach (string similarWord in result) { TaskGroup_GetSimilarKeywords_OneData d = new TaskGroup_GetSimilarKeywords_OneData(similarWord); d.BaseKeyword = strBaseKeyword; d.Successed = true; d.eSource = SimilarKeywordSource.eSimilarKeywordSource_Baidu; list.Add(d); } } } //GlobalVar.Instance.logger.Debug($"DO END [{list.Count}]"); Thread.Sleep(globalSetting.IntervalTimeMS); // 数据保护 if (list.Count() <= 0) { TaskGroup_GetSimilarKeywords_OneData d = new TaskGroup_GetSimilarKeywords_OneData(strBaseKeyword); d.BaseKeyword = ""; d.eSource = SimilarKeywordSource.eSimilarKeywordSource_Unknown; d.Successed = false; list.Add(d); list.Status = TaskStatus.eTaskStatus_Finish_Error; } return(list); }