예제 #1
0
        //这里负责调度
        public void MainWork()
        {
            int startIndex = int.Parse(ConfigurationManager.AppSettings["pageStart"].ToString());
            int endIndex   = int.Parse(ConfigurationManager.AppSettings["pageEnd"].ToString());

            //运行处理部分

            try
            {
                PrepareTemplateRegex();

                if (RunType < 0)
                {
                    return;
                }
                if (RunType == 0)
                {
                    new CollectRankManager().MainWork();
                }
                else if (RunType == 1)
                {
                    for (; startIndex <= endIndex; startIndex++)
                    {
                        string mess = string.Format("当前第{0}页开始", startIndex);
                        LogNet.LogBLL.Info(mess);
                        Console.WriteLine(mess);
                        collectManager.CollectCateAction(startIndex);
                        //回写配置文件
                        ToolHelper.AppSetValue("pageStart", (startIndex + 1).ToString());
                        mess = string.Format("当前第{0}页完毕,配置文件回写完毕", startIndex);
                        LogNet.LogBLL.Info(mess);
                        Console.WriteLine(mess);
                    }
                }
                else if (RunType == 2)
                {
                    //抓取 分类, 统计该分类下面的 精选集的 个数预计消耗时间 8小时
                    new CollectCountManager().MainWork();

                    // http://www.xiami.com/collect/key/id/1
                }
                else if (RunType == 3)
                {
                    new CollectCate2().MainWork();
                    // LayerCollectAction(collectCate.KeyId, 1);
                }
            }
            catch (Exception ex)
            {
                LogNet.LogBLL.Fatal("MainWork", ex);
            }
        }