コード例 #1
0
        protected override void Fun(List <urlInfo> task)
        {
            System.Threading.Thread.Sleep(10 * 1000);
            string date    = DateTime.Now.Date.AddDays(-1).ToShortDateString() + " 0:00:00";
            var    gotList = ORMHelper.GetModel <Tmall_Skechers_Name>(" where State =" + Program.UpdateTimes);
            Dictionary <Int64, Tmall_Skechers_Name> dic_Got = new Dictionary <long, Tmall_Skechers_Name>();

            foreach (var dg in gotList)
            {
                if (!dic_Got.ContainsKey(dg.Id))
                {
                    dic_Got.Add(dg.Id, dg);
                }
            }

            List <Tmall_Skechers_Name>   nsList = new List <Tmall_Skechers_Name>();
            List <Tmall_Skechers_Detail> dsList = new List <Tmall_Skechers_Detail>();
            int a = 0;

            foreach (var t in task)
            {
                ShowMsg(t.dataId.ToString());
                if (dic_Got.ContainsKey((long)t.dataId))
                {
                    continue;
                }
                //if (++a == 20)
                //{
                //    System.Threading.Thread.Sleep(60 * 1000);
                //    a = 0;
                //}
                var result = PageDataHelper.GotDetailData(t);
                Tmall_Skechers_Detail td = new Tmall_Skechers_Detail();
                Tmall_Skechers_Name   tn = new Tmall_Skechers_Name();
                td.Id             = tn.Id = (Int64)result.Id;
                tn.Name           = result.Name;
                td.LastUpdate     = tn.LastUpdate = result.LastUpdate;
                td.indexPrice     = result.IndexPrice;
                td.AvePrice       = result.AvePrice;
                td.Comments_Mon   = result.IndexComment;
                td.Comments_Total = result.TotalComment;
                td.Repertory      = (int)result.Repertory;
                td.Sales_Mon      = result.MonSales;
                tn.State          = td.State = sbyte.Parse(Program.UpdateTimes);
                td.Sales_Total    = result.TotalSales;
                ShowMsg(t.dataId + "  " + t.name + " " + td.AvePrice + " " + td.Sales_Mon + " " + td.Comments_Mon + td.LastUpdate);
                nsList.Add(tn);
                dsList.Add(td);
                Random random   = new Random();
                int    interval = random.Next(35, 80);
                ShowMsg(interval.ToString());
                System.Threading.Thread.Sleep(interval * 100);
            }
            DataToBase.SaveData(nsList);
            DataToBase.SaveData(dsList);
            //更新配置文件
            CC.Utility.iniHelper ini = new CC.Utility.iniHelper(Program.FilePath);
            ini.Write("state", "times", (sbyte.Parse(Program.UpdateTimes) + 1).ToString());
        }
コード例 #2
0
        protected override void Fun(List <urlInfo> task)
        {
            string date    = DateTime.Now.Date.ToShortDateString() + " 0:00:00";
            var    gotList = ORMHelper.GetModel <Tmall_Name_Anta>(" where State = '" + (Program.UpdateTimes + 1) + "' ");
            Dictionary <UInt64, Tmall_Name_Anta> dic_Got = new Dictionary <ulong, Tmall_Name_Anta>();

            foreach (var dg in gotList)
            {
                if (!dic_Got.ContainsKey(dg.Id))
                {
                    dic_Got.Add(dg.Id, dg);
                }
            }
            int a = 0;
            List <Tmall_Detail_Anta> dsList = new List <Tmall_Detail_Anta>();
            List <Tmall_Name_Anta>   nsList = new List <Tmall_Name_Anta>();

            foreach (var t in task)
            {
                a++;
                ShowMsg(t.dataId.ToString());
                if (dic_Got.ContainsKey(t.dataId))
                {
                    continue;
                }

                var result           = PageDataHelper.GotDetailData(t);
                Tmall_Detail_Anta td = new Tmall_Detail_Anta();
                Tmall_Name_Anta   tn = new Tmall_Name_Anta();
                td.Id             = tn.Id = (UInt64)result.Id;
                tn.Name           = result.Name;
                td.LastUpdate     = tn.LastUpdate = result.LastUpdate;
                td.IndexPrice     = result.IndexPrice;
                td.AvePrice       = result.AvePrice;
                td.Comments_Mon   = result.IndexComment;
                td.Comments_Total = result.TotalComment;
                td.Repertory      = (uint)result.Repertory;
                td.Sales_Mon      = result.MonSales;
                td.Sales_Total    = result.TotalSales;
                tn.State          = td.State = byte.Parse(Program.UpdateTimes);
                ShowMsg(t.dataId + "  " + t.name + " " + td.AvePrice + " " + td.Sales_Mon + " " + td.Comments_Mon + td.LastUpdate);
                nsList.Add(tn);
                dsList.Add(td);
                Random random   = new Random();
                int    interval = random.Next(25, 76);
                ShowMsg(interval.ToString());
                System.Threading.Thread.Sleep(interval * 100);
                if (a == 50)
                {
                    ShowMsg("<加入50条数据>");
                    DataToBase.SaveData(nsList);
                    DataToBase.SaveData(dsList);
                }
            }
            //更新配置文件
            CC.Utility.iniHelper ini = new CC.Utility.iniHelper(Program.FilePath);
            ini.Write("state", "times", (byte.Parse(Program.UpdateTimes) + 1).ToString());
            driver.Close();
        }
コード例 #3
0
        protected override void Fun(List <urlInfo> task)
        {
            int a = 0;
            List <Tmall_Detail_Nike> dsList = new List <Tmall_Detail_Nike>();
            List <Tmall_Name_Nike>   nsList = new List <Tmall_Name_Nike>();

            foreach (var t in task)
            {
                //if (++a == 20)
                //{
                //    System.Threading.Thread.Sleep(60 * 1000);
                //    a = 0;
                //}
                ShowMsg(t.dataId.ToString());
                var result           = PageDataHelper.GotDetailData(t);
                Tmall_Detail_Nike td = new Tmall_Detail_Nike();
                Tmall_Name_Nike   tn = new Tmall_Name_Nike();
                td.Id             = tn.Id = (UInt64)result.Id;
                tn.Name           = result.Name;
                td.LastUpdate     = tn.LastUpdate = result.LastUpdate;
                td.IndexPrice     = result.IndexPrice;
                td.AvePrice       = result.AvePrice;
                td.Comments_Mon   = result.IndexComment;
                td.Comments_Total = result.TotalComment;
                td.Repertory      = (uint)result.Repertory;
                td.Sales_Mon      = result.MonSales;
                tn.State          = td.State = sbyte.Parse(Program.UpdateTimes);
                td.Sales_Total    = result.TotalSales;
                ShowMsg(t.dataId + "  " + t.name + " " + td.AvePrice + " " + td.Sales_Mon + " " + td.Comments_Mon + td.LastUpdate);
                nsList.Add(tn);
                dsList.Add(td);
                ShowMsg("<加入一条数据>");
                DataToBase.SaveData(nsList);
                DataToBase.SaveData(dsList);
                Random random   = new Random();
                int    interval = random.Next(56, 65);
                ShowMsg(interval.ToString());
                System.Threading.Thread.Sleep(interval * 100);
            }
            //更新配置文件
            CC.Utility.iniHelper ini = new CC.Utility.iniHelper(Program.FilePath);
            ini.Write("state", "times", (sbyte.Parse(Program.UpdateTimes) + 1).ToString());
        }