Exemple #1
0
        private static void BjCrawler()
        {
            TaskEntity model = new TaskEntity
            {
                OperatorName   = "张雪艳",
                Unique         = Guid.NewGuid(),
                CreateTime     = DateTime.Now,
                TaskName       = "测试任务",
                TaskStateDicId = 1,
            };

            //Proxy.Proxy.GetInstance().ProxySave(100, 10);
            //Proxy.Proxy.GetInstance().ValidateCanUse(7);
            var OperatorName = "张雪艳"; //操作人

            //待查数据初始化
            var lists = File.ReadAllLines("E:/1.txt", Encoding.Default).ToList();

            new BaseData(model).InsertMetadata(lists, OperatorName, model, taskEntity =>
            {
                //抓取数据
                var bjqyxy = new Crawler.Bjqyxy.BjCrawler(taskEntity, t => t.TaskGuid.Equals(taskEntity.Unique));
                bjqyxy.CrawlerWork();
            });
        }
        public ActionResult Create(TaskEntity model, HttpPostedFileBase txtfile)
        {
            var stream      = txtfile.InputStream;
            var streamread  = new StreamReader(stream, Encoding.Default);
            var companyList = new List <string>();

            while (!streamread.EndOfStream)
            {
                companyList.Add(streamread.ReadLine());
            }
            model.TaskType       = EnumTaskType.BjCrawler;
            model.TaskStateDicId = 1;
            model.TaskNum        = companyList.Count;
            model.CreateTime     = DateTime.Now;
            model.IsSingelSearch = false;
            new TaskDomain().Add(model);
            new Task(() =>
            {
                new BaseData(model).InsertMetadata(companyList.ToList(), model.TaskName, model, taskEntity =>
                {
                    var bjqyxy = new Crawler.Bjqyxy.BjCrawler(taskEntity, t => t.TaskGuid.Equals(taskEntity.Unique));
                    new Task(() => { bjqyxy.CrawlerWork(); }).Start();
                });
            }).Start();
            return(Json(new { msg = $"成功上传了任务文件,系统接受到{companyList.Count}条记录,正在导入系统中。。。" }));
        }
        public ActionResult GoGather(TaskEntity model)
        {
            //Thread.Sleep(1000 * 3); //默认等待三秒
            //抓取数据
            var bjqyxy = new Crawler.Bjqyxy.BjCrawler(model, t => t.TaskGuid.Equals(model.Unique));

            new Task(() => { bjqyxy.CrawlerWork(); }).Start();
            return(Json(new { state = "nothion" }));
        }
Exemple #4
0
        private static void BjCrawler()
        {
            TaskEntity model = new TaskEntity
            {
                OperatorName = "张雪艳",
                Unique = Guid.NewGuid(),
                CreateTime = DateTime.Now,
                TaskName = "测试任务",
                TaskStateDicId = 1,
            };

            //Proxy.Proxy.GetInstance().ProxySave(100, 10);
            //Proxy.Proxy.GetInstance().ValidateCanUse(7);
            var OperatorName = "张雪艳"; //操作人

            //待查数据初始化
            var lists = File.ReadAllLines("E:/1.txt", Encoding.Default).ToList();
            new BaseData(model).InsertMetadata(lists, OperatorName, model, taskEntity =>
            {
                //抓取数据
                var bjqyxy = new Crawler.Bjqyxy.BjCrawler(taskEntity, t => t.TaskGuid.Equals(taskEntity.Unique));
                bjqyxy.CrawlerWork();
            });
        }
Exemple #5
0
 public ActionResult Create(TaskEntity model, HttpPostedFileBase txtfile)
 {
     var stream = txtfile.InputStream;
     var streamread = new StreamReader(stream, Encoding.Default);
     var companyList = new List<string>();
     while (!streamread.EndOfStream)
         companyList.Add(streamread.ReadLine());
     model.TaskType = EnumTaskType.BjCrawler;
     model.TaskStateDicId = 1;
     model.TaskNum = companyList.Count;
     model.CreateTime = DateTime.Now;
     model.IsSingelSearch = false;
     new TaskDomain().Add(model);
     new Task(() =>
     {
         new BaseData(model).InsertMetadata(companyList.ToList(), model.TaskName, model, taskEntity =>
         {
             var bjqyxy = new Crawler.Bjqyxy.BjCrawler(taskEntity, t => t.TaskGuid.Equals(taskEntity.Unique));
             new Task(() => { bjqyxy.CrawlerWork(); }).Start();
         });
     }).Start();
     return Json(new { msg = $"成功上传了任务文件,系统接受到{companyList.Count}条记录,正在导入系统中。。。" });
 }
Exemple #6
0
 public ActionResult GoGather(TaskEntity model)
 {
     //Thread.Sleep(1000 * 3); //默认等待三秒
     //抓取数据
     var bjqyxy = new Crawler.Bjqyxy.BjCrawler(model, t => t.TaskGuid.Equals(model.Unique));
     new Task(() => { bjqyxy.CrawlerWork(); }).Start();
     return Json(new { state = "nothion" });
 }