/** * 精准裂变 * 肖俊 * 2018-3-13 */ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Windows.Forms; using AllBase; using Work.Api; using Work.CollectClass; using System; using System.Collections.Concurrent; namespace Work { public class IdFessionTaobao { public static List UploadList = new List(); public static List ProductTemp = new List(); public static List ProductAllTemp = new List(); public string Name, FileName = "temp/taobao.tjm"; public static bool Running = false, GroupUp = false, NeedSave = false; public static int ThreadCount = 2, ShopCut = 0, SingleShopIdCount = 1; public static Dictionary ShopAndProductId = new Dictionary(); public static ConcurrentQueue ConcurrentQueueHtmlSaveServer = new ConcurrentQueue(); public static ConcurrentQueue ConcurrentQueueHtmlCollectioneServer = new ConcurrentQueue(); public IdFessionTaobao(string name) { Name = name; } /// /// 存储到服务器 /// public static void SaveHtmlToSereve() { try { while (true) { int AgainCount = 0; if (ConcurrentQueueHtmlSaveServer.Count > 0) { SaveServerParm ssp = null; if (!ConcurrentQueueHtmlSaveServer.TryDequeue(out ssp)) { continue; } Again: bool bo = ServerTemp.Set(ssp.SaveType, ssp.ProuctId, ssp.SaveHtml); if (bo == false) { AgainCount++; if (AgainCount >= 3)//重试第三次直接跳出 { continue; } Thread.Sleep(new Random().Next(5000, 10000)); goto Again; } AgainCount = 0; } Thread.Sleep(50); } } catch (Exception ex) { LogSave.Add("SaveHtmlToSereve " + ex.ToString()); } } } public class ProductUploadBase { public long id = 0; public string url = ""; //1:淘宝 2:拼多多 3:阿里巴巴 public int site_id = 0; public int count = 0; public int deleteMainImg = 0; public string main_keyword = ""; public string name = ""; public string image = ""; public string desc_keyword = ""; public string shop_name = ""; } public class SaveServerParm { /// /// 2 拼多多或淘宝 3 阿里巴巴 /// public int SaveType { get; set; } //Id public string ProuctId { get; set; } /// /// html /// public string SaveHtml { get; set; } } }