username@email.com
2024-07-24 294494e5559dcc92670dd9800caf976853aff876
zhengcaioa/Crawler/sichuan/CcgpSichuanoperation.cs
@@ -3,10 +3,14 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using zhengcaioa.Models;
namespace Crawler.sichuan
@@ -19,142 +23,139 @@
        {
            try
            {
                //获取更新时间
                string operationStartTime = "";
                string operationEndTime = "";
                Updatetime updatetime = _ccontext.Updatetimes.Where(x => x.Sheng == "中国政采网四川省").FirstOrDefault();
                if (updatetime != null)
                logg.WriteLog("开始判断时间", "中国政采网四川省");
                if (DateTime.Now.Hour == 0 )
                {
                    operationStartTime = updatetime.Updatetime1.ToString("yyyy-MM-dd");
                    operationEndTime = DateTime.Now.ToString("yyyy-MM-dd");
                    //updatetime.Updatetime1 = DateTime.Now.AddDays(-1);
                    //_ccontext.SaveChanges();
                    DateTime datenow = DateTime.Now.Date;
                    Updatetime updatetime = _ccontext.Updatetimes.Where(x => x.Sheng == "中国政采网四川省").FirstOrDefault();
                    logg.WriteLog("datenow="+datenow.ToString("yyyy-MM-dd HH:mm:ss"), "中国政采网四川省");
                    operationStartTime = datenow.AddDays(-1).ToString("yyyy-MM-dd");
                    operationEndTime = datenow.AddDays(-1).ToString("yyyy-MM-dd");
                    logg.WriteLog("operationStartTime=" + operationStartTime, "中国政采网四川省");
                    logg.WriteLog("operationEndTime=" + operationEndTime, "中国政采网四川省");
                    var currPage = 1;
                    string sichuanpageurll = "";
                    //Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                    #region 意向公开
                    currPage = 1;
                    sichuanpageurll = "https://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=9&dbselect=bidx&kw=%E6%84%8F%E5%90%91&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                    logg.WriteLog("中国政采网四川省意向公开 开始获取", "中国政采网四川省");
                    yixianggonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage);
                    logg.WriteLog("中国政采网四川省意向公开 开始获取结束", "中国政采网四川省");
                    #endregion
                    //Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                    #region 公开招标
                    currPage = 1;
                    sichuanpageurll = "https://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=1&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                    logg.WriteLog("中国政采网四川省采购公告 公开招标 开始获取", "中国政采网四川省");
                    caigougonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage, "1", "公开招标");
                    logg.WriteLog("中国政采网四川省采购公告 公开招标 开始获取结束", "中国政采网四川省");
                    #endregion
                    //Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                    #region 询价
                    currPage = 1;
                    sichuanpageurll = "https://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=2&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                    logg.WriteLog("中国政采网四川省采购公告 询价 开始获取", "中国政采网四川省");
                    caigougonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage, "4", "询价");
                    logg.WriteLog("中国政采网四川省采购公告 询价 开始获取结束", "中国政采网四川省");
                    #endregion
                    //Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                    #region 竞争性谈判
                    currPage = 1;
                    sichuanpageurll = "https://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=3&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                    logg.WriteLog("中国政采网四川省采购公告 竞争性谈判 开始获取", "中国政采网四川省");
                    caigougonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage, "5", "竞争性谈判");
                    logg.WriteLog("中国政采网四川省采购公告 竞争性谈判 开始获取结束", "中国政采网四川省");
                    #endregion
                    //Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                    #region 单一来源
                    currPage = 1;
                    sichuanpageurll = "https://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=4&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                    logg.WriteLog("中国政采网四川省采购公告 单一来源 开始获取", "中国政采网四川省");
                    caigougonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage, "7", "单一来源");
                    logg.WriteLog("中国政采网四川省采购公告 单一来源 开始获取结束", "中国政采网四川省");
                    #endregion
                    //Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                    #region 邀请招标
                    currPage = 1;
                    sichuanpageurll = "https://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=6&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                    logg.WriteLog("中国政采网四川省采购公告 邀请招标 开始获取", "中国政采网四川省");
                    caigougonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage, "2", "邀请招标");
                    logg.WriteLog("中国政采网四川省采购公告 邀请招标 开始获取结束", "中国政采网四川省");
                    #endregion
                    //Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                    #region 竞争性磋商
                    currPage = 1;
                    sichuanpageurll = "https://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=10&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                    logg.WriteLog("中国政采网四川省采购公告 竞争性磋商 开始获取", "中国政采网四川省");
                    caigougonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage, "3", "竞争性磋商");
                    logg.WriteLog("中国政采网四川省采购公告 竞争性磋商 开始获取结束", "中国政采网四川省");
                    #endregion
                    //Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                    #region 中标公告
                    currPage = 1;
                    sichuanpageurll = "https://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=7&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                    logg.WriteLog("中国政采网四川省中标公告 开始获取", "中国政采网四川省");
                    zhongbiaogonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage);
                    logg.WriteLog("中国政采网四川省中标公告 开始获取结束", "中国政采网四川省");
                    #endregion
                    //Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                    #region 成交公告
                    currPage = 1;
                    sichuanpageurll = "https://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=11&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                    logg.WriteLog("中国政采网四川省成交公告 开始获取", "中国政采网四川省");
                    zhongbiaogonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage);
                    logg.WriteLog("中国政采网四川省成交公告 开始获取结束", "中国政采网四川省");
                    #endregion
                    //Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                    #region 更正公告
                    currPage = 1;
                    sichuanpageurll = "https://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=8&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                    logg.WriteLog("中国政采网四川省更正公告 开始获取", "中国政采网四川省");
                    gengzhenggonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage);
                    logg.WriteLog("中国政采网四川省更正公告 开始获取结束", "中国政采网四川省");
                    #endregion
                    //Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                    #region 废标公告
                    currPage = 1;
                    sichuanpageurll = "https://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=12&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                    logg.WriteLog("中国政采网四川省废标公告 开始获取", "中国政采网四川省");
                    feibiaogonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage);
                    logg.WriteLog("中国政采网四川省废标公告 开始获取结束", "中国政采网四川省");
                    #endregion
                    //保存最后更新时间
                    if (updatetime != null)
                    {
                        updatetime.Updatetime1 = datenow;
                        _ccontext.SaveChanges();
                    }
                    else
                    {
                        updatetime = new Updatetime();
                        updatetime.Id = Guid.NewGuid().ToString();
                        updatetime.Sheng = "中国政采网四川省";
                        updatetime.Updatetime1 = datenow;
                        _ccontext.Updatetimes.Add(updatetime);
                        _ccontext.SaveChanges();
                    }
                    Thread.CurrentThread.Join(1000 * 60 * 60);//阻止设定时间
                }
                else
                {
                    operationStartTime = "2021-12-01"; //DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd");
                    operationEndTime = "2022-12-01";//DateTime.Now.ToString("yyyy-MM-dd");
                }
                var currPage = 1;
                string sichuanpageurll = "";
                #region 意向公开
                currPage = 1;
                sichuanpageurll = "http://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=9&dbselect=bidx&kw=%E6%84%8F%E5%90%91&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                logg.WriteLog("中国政采网四川省意向公开 开始获取", "中国政采网四川省");
                yixianggonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage);
                logg.WriteLog("中国政采网四川省意向公开 开始获取结束", "中国政采网四川省");
                #endregion
                Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                #region 公开招标
                currPage = 1;
                sichuanpageurll = "http://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=1&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                logg.WriteLog("中国政采网四川省采购公告 公开招标 开始获取", "中国政采网四川省");
                caigougonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage, "1", "公开招标");
                logg.WriteLog("中国政采网四川省采购公告 公开招标 开始获取结束", "中国政采网四川省");
                #endregion
                Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                #region 询价
                currPage = 1;
                sichuanpageurll = "http://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=2&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                logg.WriteLog("中国政采网四川省采购公告 询价 开始获取", "中国政采网四川省");
                caigougonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage, "4", "询价");
                logg.WriteLog("中国政采网四川省采购公告 询价 开始获取结束", "中国政采网四川省");
                #endregion
                Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                #region 竞争性谈判
                currPage = 1;
                sichuanpageurll = "http://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=3&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                logg.WriteLog("中国政采网四川省采购公告 竞争性谈判 开始获取", "中国政采网四川省");
                caigougonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage, "5", "竞争性谈判");
                logg.WriteLog("中国政采网四川省采购公告 竞争性谈判 开始获取结束", "中国政采网四川省");
                #endregion
                Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                #region 单一来源
                currPage = 1;
                sichuanpageurll = "http://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=4&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                logg.WriteLog("中国政采网四川省采购公告 单一来源 开始获取", "中国政采网四川省");
                caigougonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage, "7", "单一来源");
                logg.WriteLog("中国政采网四川省采购公告 单一来源 开始获取结束", "中国政采网四川省");
                #endregion
                Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                #region 邀请招标
                currPage = 1;
                sichuanpageurll = "http://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=6&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                logg.WriteLog("中国政采网四川省采购公告 邀请招标 开始获取", "中国政采网四川省");
                caigougonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage, "2", "邀请招标");
                logg.WriteLog("中国政采网四川省采购公告 邀请招标 开始获取结束", "中国政采网四川省");
                #endregion
                Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                #region 竞争性磋商
                currPage = 1;
                sichuanpageurll = "http://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=10&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                logg.WriteLog("中国政采网四川省采购公告 竞争性磋商 开始获取", "中国政采网四川省");
                caigougonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage, "3", "竞争性磋商");
                logg.WriteLog("中国政采网四川省采购公告 竞争性磋商 开始获取结束", "中国政采网四川省");
                #endregion
                Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                #region 中标公告
                currPage = 1;
                sichuanpageurll = "http://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=7&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                logg.WriteLog("中国政采网四川省中标公告 开始获取", "中国政采网四川省");
                zhongbiaogonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage);
                logg.WriteLog("中国政采网四川省中标公告 开始获取结束", "中国政采网四川省");
                #endregion
                Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                #region 成交公告
                currPage = 1;
                sichuanpageurll = "http://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=11&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                logg.WriteLog("中国政采网四川省成交公告 开始获取", "中国政采网四川省");
                zhongbiaogonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage);
                logg.WriteLog("中国政采网四川省成交公告 开始获取结束", "中国政采网四川省");
                #endregion
                Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                #region 更正公告
                currPage = 1;
                sichuanpageurll = "http://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=8&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                logg.WriteLog("中国政采网四川省更正公告 开始获取", "中国政采网四川省");
                gengzhenggonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime, currPage);
                logg.WriteLog("中国政采网四川省更正公告 开始获取结束", "中国政采网四川省");
                #endregion
                Thread.CurrentThread.Join(1000 * 60 * 30);//阻止设定时间
                #region 废标公告
                currPage = 1;
                sichuanpageurll = "http://search.ccgp.gov.cn/bxsearch?searchtype=1&page_index=1&bidSort=0&buyerName=&projectId=&pinMu=0&bidType=12&dbselect=bidx&kw=&start_time=&end_time=&timeType=6&displayZone=%E5%9B%9B%E5%B7%9D&zoneId=51&pppStatus=&agentName=";
                logg.WriteLog("中国政采网四川省废标公告 开始获取", "中国政采网四川省");
                feibiaogonggao(_ccontext, sichuanpageurll, operationStartTime, operationEndTime , currPage);
                logg.WriteLog("中国政采网四川省废标公告 开始获取结束", "中国政采网四川省");
                #endregion
                //保存最后更新时间
                if (updatetime != null)
                {
                    updatetime.Updatetime1 = DateTime.Now.AddDays(-1);
                    _ccontext.SaveChanges();
                }
                else
                {
                    updatetime = new Updatetime();
                    updatetime.Id = Guid.NewGuid().ToString();
                    updatetime.Sheng = "中国政采网四川省";
                    updatetime.Updatetime1 = DateTime.Now.AddDays(-1);
                    _ccontext.Updatetimes.Add(updatetime);
                    _ccontext.SaveChanges();
                }
                //datenow = DateTime.Now.Date.AddDays(1);
            }
            catch (Exception ex)
            {
@@ -174,7 +175,7 @@
        //采购公告
        public static void caigougonggao(WebCrawlerContext _ccontext, string sichuanpageurll, string startTime, string endTime , int page, string cgfs, string cgfsName)
        public static async void caigougonggao(WebCrawlerContext _ccontext, string sichuanpageurll, string startTime, string endTime , int page, string cgfs, string cgfsName)
        {
            sichuanpageurll = sichuanpageurll.Replace("start_time=", "start_time=" + startTime.Replace("-", "%3A"));
@@ -183,17 +184,41 @@
            var list11 = new List<AngleSharp.Dom.IElement>();
            while (true)
            {
                Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                logg.WriteLog(page.ToString(), "中国政采网四川省");
                string sichuanpageurl2 = sichuanpageurll.Replace("page_index=1", "page_index=" + page);
                try
                {
                    using (HttpClient client = new HttpClient())
                    HttpClientHandler handler = new HttpClientHandler();
                    handler.CookieContainer = new CookieContainer();
                    using (HttpClient client = new HttpClient(handler))
                    {
                        client.Timeout = TimeSpan.FromSeconds(60);
                        client.DefaultRequestHeaders.Add("Accept", "*/*");
                        client.DefaultRequestHeaders.Add("Accept-Encoding", "gzip, deflate, br");
                        client.DefaultRequestHeaders.Add("Host", "search.ccgp.gov.cn");
                        //List<sichuanjieshoudtl> data = new List<sichuanjieshoudtl>();
                        HttpResponseMessage response = client.GetAsync(sichuanpageurl2).Result;
                        var res = response.Content.ReadAsStringAsync().Result;
                        string res = "";
                        if (response.IsSuccessStatusCode)
                        {
                            using (var responseStream = await response.Content.ReadAsStreamAsync())
                            {
                                using (var decompressedStream = new GZipStream(responseStream, CompressionMode.Decompress))
                                {
                                    using (var reader = new StreamReader(decompressedStream))
                                    {
                                        res = await reader.ReadToEndAsync();
                                        // 处理解压缩后的响应内容
                                    }
                                }
                            }
                        }
                        else
                        {
                            // 处理请求失败的情况
                        }
                        //var res = response.Content.ReadAsStringAsync().Result;
                        var document = parser.ParseDocument(res);
                        var sssdfsdfsd = document.All.Where(m => m.ClassName == "vT-srch-result-list").FirstOrDefault();
                        var contentList = sssdfsdfsd.QuerySelector("ul");
@@ -232,15 +257,50 @@
                                list11 = lists.ToList();
                            }
                            string[] bbb = null;
                            var scriptElements = document.QuerySelectorAll("script");
                            foreach (var scriptElement in scriptElements)
                            {
                                var scriptText = scriptElement.TextContent;
                                if (scriptText.Contains("var ohtmlurls")) // 检查文本中是否包含特定变量
                                {
                                        int startIndex = scriptText.IndexOf('"') + 1;
                                        int endIndex = scriptText.IndexOf('"', startIndex);
                                        if (startIndex > 0 && endIndex > startIndex)
                                        {
                                        var aaaa =   scriptText.Substring(startIndex, endIndex - startIndex);
                                        if (!string.IsNullOrEmpty(aaaa))
                                        {
                                             bbb = aaaa.Split(',');
                                        }
                                    }
                                }
                            }
                            int ccc = 0;
                            foreach (var sichuanjieshoudtl1 in lists)
                            {
                                Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                                Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                                try
                                {
                                    sichuanjieshoudtl aaaaaaaa = new sichuanjieshoudtl();
                                    aaaaaaaa.pageurl = sichuanjieshoudtl1.QuerySelector("a").GetAttribute("href");
                                    if(bbb!=null && bbb.Length>= ccc && !string.IsNullOrEmpty(bbb[ccc]))
                                    {
                                        aaaaaaaa.pageurl = bbb[ccc];
                                        ccc = ccc + 1;
                                    }
                                    else
                                    {
                                        ccc = ccc + 1;
                                        continue;
                                    }
                                   // aaaaaaaa.pageurl = sichuanjieshoudtl1.QuerySelector("a").GetAttribute("href");
                                    logg.WriteLog(aaaaaaaa.pageurl, "中国政采网四川省");
                                    aaaaaaaa.title = sichuanjieshoudtl1.QuerySelector("a").TextContent.Replace("\n", "").Trim();
@@ -265,7 +325,10 @@
                                    }
                                    using (HttpClient clientdtl = new HttpClient())
                                    {
                                        var zhengfuProjectcount = _ccontext.ZhengfuProjects.Count(x => (x.RecStatus == "A" && x.Pageurl == aaaaaaaa.pageurl) || (x.RecStatus == "A" && x.Title == aaaaaaaa.title && x.Gglx == "02" && x.OpenTenderTime == DateTime.Parse(NoticeTime)));
                                        var notime = DateTime.Parse(NoticeTime).ToString("yyyy-MM-dd");
                                        var notimestart = DateTime.Parse(notime);
                                        var notimeend = notimestart.AddDays(1);
                                        var zhengfuProjectcount = _ccontext.ZhengfuProjects.Count(x => (x.RecStatus == "A" && x.Pageurl == aaaaaaaa.pageurl) || (x.RecStatus == "A" && x.Title == aaaaaaaa.title && x.Gglx == "02" && x.NoticeTime >= notimestart && x.NoticeTime < notimeend) );
                                        if (zhengfuProjectcount <= 0)
@@ -289,7 +352,7 @@
                                                {
                                                    var ssss = fujianya.Id;
                                                    var sssss = fujianya.InnerHtml;
                                                    fujianhtml += "<tr><td class=\"bid_attachtab_content\">附件下载:<a class=\"bizDownload\" target=\"_blank\" href =\"http://download.ccgp.gov.cn/oss/download?uuid=" + ssss + "\" id=\"0E1723104D34335C527765FF6CD28A\" title=\"点击下载\">" + sssss + "</a><br></td></tr>";
                                                    fujianhtml += "<tr><td class=\"bid_attachtab_content\">附件下载:<a class=\"bizDownload\" target=\"_blank\" href =\"https://download.ccgp.gov.cn/oss/download?uuid=" + ssss + "\" id=\"0E1723104D34335C527765FF6CD28A\" title=\"点击下载\">" + sssss + "</a><br></td></tr>";
                                                }
                                                fujianhtml += "</tbody></table></div>";
@@ -498,7 +561,7 @@
                                            _ccontext.SaveChanges();
                                            Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                                            Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                                        }
                                    }
                                }
@@ -515,6 +578,8 @@
                            }
                        }
                    }
                    page += 1;
                }
                catch (Exception ex)
                {
@@ -523,9 +588,10 @@
                    logg.WriteLog(ex.StackTrace, "中国政采网四川省");
                    logg.WriteLog(ex.ToString(), "中国政采网四川省");
                    Thread.CurrentThread.Join(1000 * 60 * 5);//阻止设定时间
                }
             
                page += 1;
               
            }
@@ -539,7 +605,7 @@
        //意向公开
        public static void yixianggonggao(WebCrawlerContext _ccontext, string sichuanpageurll, string startTime,string endTime, int page)
        public static async void yixianggonggao(WebCrawlerContext _ccontext, string sichuanpageurll, string startTime,string endTime, int page)
        {
            sichuanpageurll = sichuanpageurll.Replace("start_time=", "start_time=" + startTime.Replace("-", "%3A"));
@@ -548,17 +614,41 @@
            var list11 = new List<AngleSharp.Dom.IElement>();
            while (true)
            {
                Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                logg.WriteLog(page.ToString(), "中国政采网四川省");
                string sichuanpageurl2 = sichuanpageurll.Replace("page_index=1", "page_index=" + page);
                try
                {
                    using (HttpClient client = new HttpClient())
                    HttpClientHandler handler = new HttpClientHandler();
                    handler.CookieContainer = new CookieContainer();
                    using (HttpClient client = new HttpClient(handler))
                    {
                        client.Timeout = TimeSpan.FromSeconds(60);
                        client.DefaultRequestHeaders.Add("Accept", "*/*");
                        client.DefaultRequestHeaders.Add("Accept-Encoding", "gzip, deflate, br");
                        client.DefaultRequestHeaders.Add("Host", "search.ccgp.gov.cn");
                        //List<sichuanjieshoudtl> data = new List<sichuanjieshoudtl>();
                        HttpResponseMessage response = client.GetAsync(sichuanpageurl2).Result;
                        var res = response.Content.ReadAsStringAsync().Result;
                        //var res = response.Content.ReadAsStringAsync().Result;
                        string res = "";
                        if (response.IsSuccessStatusCode)
                        {
                            using (var responseStream = await response.Content.ReadAsStreamAsync())
                            {
                                using (var decompressedStream = new GZipStream(responseStream, CompressionMode.Decompress))
                                {
                                    using (var reader = new StreamReader(decompressedStream))
                                    {
                                        res = await reader.ReadToEndAsync();
                                        // 处理解压缩后的响应内容
                                    }
                                }
                            }
                        }
                        else
                        {
                            // 处理请求失败的情况
                        }
                        var document = parser.ParseDocument(res);
                        var sssdfsdfsd = document.All.Where(m => m.ClassName == "vT-srch-result-list").FirstOrDefault();
                        var contentList = sssdfsdfsd.QuerySelector("ul");
@@ -596,13 +686,51 @@
                            {
                                list11 = lists.ToList();
                            }
                            string[] bbb = null;
                            var scriptElements = document.QuerySelectorAll("script");
                            foreach (var scriptElement in scriptElements)
                            {
                                var scriptText = scriptElement.TextContent;
                                if (scriptText.Contains("var ohtmlurls")) // 检查文本中是否包含特定变量
                                {
                                    int startIndex = scriptText.IndexOf('"') + 1;
                                    int endIndex = scriptText.IndexOf('"', startIndex);
                                    if (startIndex > 0 && endIndex > startIndex)
                                    {
                                        var aaaa = scriptText.Substring(startIndex, endIndex - startIndex);
                                        if (!string.IsNullOrEmpty(aaaa))
                                        {
                                            bbb = aaaa.Split(',');
                                        }
                                    }
                                }
                            }
                            int ccc = 0;
                            foreach (var sichuanjieshoudtl1 in lists)
                            {
                                Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                                Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                                try
                                {
                                    sichuanjieshoudtl aaaaaaaa = new sichuanjieshoudtl();
                                    aaaaaaaa.pageurl = sichuanjieshoudtl1.QuerySelector("a").GetAttribute("href");
                                    if (bbb != null && bbb.Length >= ccc && !string.IsNullOrEmpty(bbb[ccc]))
                                    {
                                        aaaaaaaa.pageurl = bbb[ccc];
                                        ccc = ccc + 1;
                                    }
                                    else
                                    {
                                        ccc = ccc + 1;
                                        continue;
                                    }
                                    // aaaaaaaa.pageurl = sichuanjieshoudtl1.QuerySelector("a").GetAttribute("href");
                                    logg.WriteLog(aaaaaaaa.pageurl, "中国政采网四川省");
                                    aaaaaaaa.title = sichuanjieshoudtl1.QuerySelector("a").TextContent.Replace("\n", "").Trim();
@@ -627,7 +755,10 @@
                                    }
                                    using (HttpClient clientdtl = new HttpClient())
                                    {
                                        var zhengfuProjectCount = _ccontext.ZhengfuProjects.Count(x => (x.RecStatus == "A" && x.Pageurl == aaaaaaaa.pageurl) || (x.RecStatus == "A" && x.Title == aaaaaaaa.title && x.Gglx == "01" && x.OpenTenderTime == DateTime.Parse(NoticeTime)));
                                        var notime = DateTime.Parse(NoticeTime).ToString("yyyy-MM-dd");
                                        var notimestart = DateTime.Parse(notime);
                                        var notimeend = notimestart.AddDays(1);
                                        var zhengfuProjectCount = _ccontext.ZhengfuProjects.Count(x => (x.RecStatus == "A" && x.Pageurl == aaaaaaaa.pageurl) || (x.RecStatus == "A" && x.Title == aaaaaaaa.title && x.Gglx == "01" && x.NoticeTime >= notimestart && x.NoticeTime < notimeend));
                                        if (zhengfuProjectCount <= 0)
                                        {
                                            clientdtl.Timeout = TimeSpan.FromSeconds(60);
@@ -649,7 +780,7 @@
                                                {
                                                    var ssss = fujianya.Id;
                                                    var sssss = fujianya.InnerHtml;
                                                    fujianhtml += "<tr><td class=\"bid_attachtab_content\">附件下载:<a class=\"bizDownload\" target=\"_blank\" href =\"http://download.ccgp.gov.cn/oss/download?uuid=" + ssss + "\" id=\"0E1723104D34335C527765FF6CD28A\" title=\"点击下载\">" + sssss + "</a><br></td></tr>";
                                                    fujianhtml += "<tr><td class=\"bid_attachtab_content\">附件下载:<a class=\"bizDownload\" target=\"_blank\" href =\"https://download.ccgp.gov.cn/oss/download?uuid=" + ssss + "\" id=\"0E1723104D34335C527765FF6CD28A\" title=\"点击下载\">" + sssss + "</a><br></td></tr>";
                                                }
                                                fujianhtml += "</tbody></table></div>";
@@ -672,8 +803,8 @@
                                                {
                                                    if (td[i].TextContent.IndexOf("项目编号:") >= 0)
                                                    {
                                                        OpenTenderCode = td[i].TextContent.Replace("项目编号:", "").Replace("/", "").Trim();
                                                        if (string.IsNullOrEmpty(OpenTenderCode))
                                                            OpenTenderCode = td[i].TextContent.Replace("项目编号:", "").Replace("/", "").Trim();
                                                    }
                                                    if (td[i].TextContent.IndexOf("预算金额:") >= 0)
@@ -806,7 +937,7 @@
                                            _ccontext.SaveChanges();
                                            Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                                            Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                                        }
                                    }
                                }
@@ -823,6 +954,8 @@
                            }
                        }
                    }
                    page += 1;
                }
                catch (Exception ex)
                {
@@ -831,10 +964,11 @@
                    logg.WriteLog(ex.StackTrace, "中国政采网四川省");
                    logg.WriteLog(ex.ToString(), "中国政采网四川省");
                    Thread.CurrentThread.Join(1000 * 60 * 5);//阻止设定时间
                }
             
                page += 1;
                
            }
@@ -848,7 +982,7 @@
        //结果公告
        public static void zhongbiaogonggao(WebCrawlerContext _ccontext, string sichuanpageurll, string startTime, string endTime , int page)
        public static async void zhongbiaogonggao(WebCrawlerContext _ccontext, string sichuanpageurll, string startTime, string endTime , int page)
        {
            sichuanpageurll = sichuanpageurll.Replace("start_time=", "start_time=" + startTime.Replace("-", "%3A"));
@@ -857,17 +991,41 @@
            var list11 = new List<AngleSharp.Dom.IElement>();
            while (true)
            {
                Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                logg.WriteLog(page.ToString(), "中国政采网四川省");
                string sichuanpageurl2 = sichuanpageurll.Replace("page_index=1", "page_index=" + page);
                try
                {
                    using (HttpClient client = new HttpClient())
                    HttpClientHandler handler = new HttpClientHandler();
                    handler.CookieContainer = new CookieContainer();
                    using (HttpClient client = new HttpClient(handler))
                    {
                        client.Timeout = TimeSpan.FromSeconds(60);
                        client.DefaultRequestHeaders.Add("Accept", "*/*");
                        client.DefaultRequestHeaders.Add("Accept-Encoding", "gzip, deflate, br");
                        client.DefaultRequestHeaders.Add("Host", "search.ccgp.gov.cn");
                        //List<sichuanjieshoudtl> data = new List<sichuanjieshoudtl>();
                        HttpResponseMessage response = client.GetAsync(sichuanpageurl2).Result;
                        var res = response.Content.ReadAsStringAsync().Result;
                        //var res = response.Content.ReadAsStringAsync().Result;
                        string res = "";
                        if (response.IsSuccessStatusCode)
                        {
                            using (var responseStream = await response.Content.ReadAsStreamAsync())
                            {
                                using (var decompressedStream = new GZipStream(responseStream, CompressionMode.Decompress))
                                {
                                    using (var reader = new StreamReader(decompressedStream))
                                    {
                                        res = await reader.ReadToEndAsync();
                                        // 处理解压缩后的响应内容
                                    }
                                }
                            }
                        }
                        else
                        {
                            // 处理请求失败的情况
                        }
                        var document = parser.ParseDocument(res);
                        var sssdfsdfsd = document.All.Where(m => m.ClassName == "vT-srch-result-list").FirstOrDefault();
                        var contentList = sssdfsdfsd.QuerySelector("ul");
@@ -906,13 +1064,50 @@
                                list11 = lists.ToList();
                            }
                            string[] bbb = null;
                            var scriptElements = document.QuerySelectorAll("script");
                            foreach (var scriptElement in scriptElements)
                            {
                                var scriptText = scriptElement.TextContent;
                                if (scriptText.Contains("var ohtmlurls")) // 检查文本中是否包含特定变量
                                {
                                    int startIndex = scriptText.IndexOf('"') + 1;
                                    int endIndex = scriptText.IndexOf('"', startIndex);
                                    if (startIndex > 0 && endIndex > startIndex)
                                    {
                                        var aaaa = scriptText.Substring(startIndex, endIndex - startIndex);
                                        if (!string.IsNullOrEmpty(aaaa))
                                        {
                                            bbb = aaaa.Split(',');
                                        }
                                    }
                                }
                            }
                            int ccc = 0;
                            foreach (var sichuanjieshoudtl1 in lists)
                            {
                                Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                                Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                                try
                                {
                                    sichuanjieshoudtl aaaaaaaa = new sichuanjieshoudtl();
                                    aaaaaaaa.pageurl = sichuanjieshoudtl1.QuerySelector("a").GetAttribute("href");
                                    if (bbb != null && bbb.Length >= ccc && !string.IsNullOrEmpty(bbb[ccc]))
                                    {
                                        aaaaaaaa.pageurl = bbb[ccc];
                                        ccc = ccc + 1;
                                    }
                                    else
                                    {
                                        ccc = ccc + 1;
                                        continue;
                                    }
                                    // aaaaaaaa.pageurl = sichuanjieshoudtl1.QuerySelector("a").GetAttribute("href");
                                    logg.WriteLog(aaaaaaaa.pageurl, "中国政采网四川省");
                                    aaaaaaaa.title = sichuanjieshoudtl1.QuerySelector("a").TextContent.Replace("\n", "").Trim();
@@ -937,7 +1132,10 @@
                                    }
                                    using (HttpClient clientdtl = new HttpClient())
                                    {
                                        var zhengfuProjectCount = _ccontext.ZhengfuProjects.Count(x => (x.RecStatus == "A" && x.Pageurl == aaaaaaaa.pageurl) || (x.RecStatus == "A" && x.Title == aaaaaaaa.title && x.Gglx == "03" && x.OpenTenderTime == DateTime.Parse(NoticeTime)));
                                        var notime = DateTime.Parse(NoticeTime).ToString("yyyy-MM-dd");
                                        var notimestart = DateTime.Parse(notime);
                                        var notimeend = notimestart.AddDays(1);
                                        var zhengfuProjectCount = _ccontext.ZhengfuProjects.Count(x => (x.RecStatus == "A" && x.Pageurl == aaaaaaaa.pageurl) || (x.RecStatus == "A" && x.Title == aaaaaaaa.title && x.Gglx == "03" && x.NoticeTime >= notimestart && x.NoticeTime < notimeend));
                                        if (zhengfuProjectCount <= 0)
                                        {
                                            clientdtl.Timeout = TimeSpan.FromSeconds(60);
@@ -959,7 +1157,7 @@
                                                {
                                                    var ssss = fujianya.Id;
                                                    var sssss = fujianya.InnerHtml;
                                                    fujianhtml += "<tr><td class=\"bid_attachtab_content\">附件下载:<a class=\"bizDownload\" target=\"_blank\" href =\"http://download.ccgp.gov.cn/oss/download?uuid=" + ssss + "\" id=\"0E1723104D34335C527765FF6CD28A\" title=\"点击下载\">" + sssss + "</a><br></td></tr>";
                                                    fujianhtml += "<tr><td class=\"bid_attachtab_content\">附件下载:<a class=\"bizDownload\" target=\"_blank\" href =\"https://download.ccgp.gov.cn/oss/download?uuid=" + ssss + "\" id=\"0E1723104D34335C527765FF6CD28A\" title=\"点击下载\">" + sssss + "</a><br></td></tr>";
                                                }
                                                fujianhtml += "</tbody></table></div>";
@@ -982,8 +1180,8 @@
                                                {
                                                    if (td[i].TextContent.IndexOf("项目编号:") >= 0)
                                                    {
                                                        OpenTenderCode = td[i].TextContent.Replace("项目编号:", "").Replace("一、", "").Trim();
                                                        if (string.IsNullOrEmpty(OpenTenderCode))
                                                            OpenTenderCode = td[i].TextContent.Replace("项目编号:", "").Replace("一、", "").Trim();
                                                        if (OpenTenderCode.IndexOf("(招标文件编号") >= 0)
                                                        {
@@ -1030,8 +1228,8 @@
                                                {
                                                    if (td[i].TextContent.IndexOf("项目编号:") >= 0)
                                                    {
                                                        OpenTenderCode = td[i].TextContent.Replace("项目编号:", "").Replace("一、", "").Trim();
                                                        if (string.IsNullOrEmpty(OpenTenderCode))
                                                            OpenTenderCode = td[i].TextContent.Replace("项目编号:", "").Replace("一、", "").Trim();
                                                        if (OpenTenderCode.IndexOf("(招标文件编号") >= 0)
                                                        {
@@ -1169,7 +1367,7 @@
                                            _ccontext.SaveChanges();
                                            Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                                            Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                                        }
                                    }
                                }
@@ -1186,6 +1384,7 @@
                            }
                        }
                    }
                    page += 1;
                }
                catch (Exception ex)
                {
@@ -1194,10 +1393,11 @@
                    logg.WriteLog(ex.StackTrace, "中国政采网四川省");
                    logg.WriteLog(ex.ToString(), "中国政采网四川省");
                    Thread.CurrentThread.Join(1000 * 60 * 5);//阻止设定时间
                }
            
                page += 1;
               
            }
@@ -1210,7 +1410,7 @@
        }
        //更正公告
        public static void gengzhenggonggao(WebCrawlerContext _ccontext, string sichuanpageurll, string startTime, string endTime , int page)
        public static async void gengzhenggonggao(WebCrawlerContext _ccontext, string sichuanpageurll, string startTime, string endTime , int page)
        {
            sichuanpageurll = sichuanpageurll.Replace("start_time=", "start_time=" + startTime.Replace("-", "%3A"));
@@ -1219,17 +1419,41 @@
            var list11 = new List<AngleSharp.Dom.IElement>();
            while (true)
            {
                Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                logg.WriteLog(page.ToString(), "中国政采网四川省");
                string sichuanpageurl2 = sichuanpageurll.Replace("page_index=1", "page_index=" + page);
                try
                {
                    using (HttpClient client = new HttpClient())
                    HttpClientHandler handler = new HttpClientHandler();
                    handler.CookieContainer = new CookieContainer();
                    using (HttpClient client = new HttpClient(handler))
                    {
                        client.Timeout = TimeSpan.FromSeconds(60);
                        client.DefaultRequestHeaders.Add("Accept", "*/*");
                        client.DefaultRequestHeaders.Add("Accept-Encoding", "gzip, deflate, br");
                        client.DefaultRequestHeaders.Add("Host", "search.ccgp.gov.cn");
                        //List<sichuanjieshoudtl> data = new List<sichuanjieshoudtl>();
                        HttpResponseMessage response = client.GetAsync(sichuanpageurl2).Result;
                        var res = response.Content.ReadAsStringAsync().Result;
                        //var res = response.Content.ReadAsStringAsync().Result;
                        string res = "";
                        if (response.IsSuccessStatusCode)
                        {
                            using (var responseStream = await response.Content.ReadAsStreamAsync())
                            {
                                using (var decompressedStream = new GZipStream(responseStream, CompressionMode.Decompress))
                                {
                                    using (var reader = new StreamReader(decompressedStream))
                                    {
                                        res = await reader.ReadToEndAsync();
                                        // 处理解压缩后的响应内容
                                    }
                                }
                            }
                        }
                        else
                        {
                            // 处理请求失败的情况
                        }
                        var document = parser.ParseDocument(res);
                        var sssdfsdfsd = document.All.Where(m => m.ClassName == "vT-srch-result-list").FirstOrDefault();
                        var contentList = sssdfsdfsd.QuerySelector("ul");
@@ -1268,13 +1492,50 @@
                                list11 = lists.ToList();
                            }
                            string[] bbb = null;
                            var scriptElements = document.QuerySelectorAll("script");
                            foreach (var scriptElement in scriptElements)
                            {
                                var scriptText = scriptElement.TextContent;
                                if (scriptText.Contains("var ohtmlurls")) // 检查文本中是否包含特定变量
                                {
                                    int startIndex = scriptText.IndexOf('"') + 1;
                                    int endIndex = scriptText.IndexOf('"', startIndex);
                                    if (startIndex > 0 && endIndex > startIndex)
                                    {
                                        var aaaa = scriptText.Substring(startIndex, endIndex - startIndex);
                                        if (!string.IsNullOrEmpty(aaaa))
                                        {
                                            bbb = aaaa.Split(',');
                                        }
                                    }
                                }
                            }
                            int ccc = 0;
                            foreach (var sichuanjieshoudtl1 in lists)
                            {
                                Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                                Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                                try
                                {
                                    sichuanjieshoudtl aaaaaaaa = new sichuanjieshoudtl();
                                    aaaaaaaa.pageurl = sichuanjieshoudtl1.QuerySelector("a").GetAttribute("href");
                                    if (bbb != null && bbb.Length >= ccc && !string.IsNullOrEmpty(bbb[ccc]))
                                    {
                                        aaaaaaaa.pageurl = bbb[ccc];
                                        ccc = ccc + 1;
                                    }
                                    else
                                    {
                                        ccc = ccc + 1;
                                        continue;
                                    }
                                    // aaaaaaaa.pageurl = sichuanjieshoudtl1.QuerySelector("a").GetAttribute("href");
                                    logg.WriteLog(aaaaaaaa.pageurl, "中国政采网四川省");
                                    aaaaaaaa.title = sichuanjieshoudtl1.QuerySelector("a").TextContent.Replace("\n", "").Trim();
@@ -1299,7 +1560,10 @@
                                    }
                                    using (HttpClient clientdtl = new HttpClient())
                                    {
                                        var zhengfuProjectCount = _ccontext.ZhengfuProjects.Count(x => (x.RecStatus == "A" && x.Pageurl == aaaaaaaa.pageurl) || (x.RecStatus == "A" && x.Title == aaaaaaaa.title && x.Gglx == "04" && x.OpenTenderTime == DateTime.Parse(NoticeTime)));
                                        var notime = DateTime.Parse(NoticeTime).ToString("yyyy-MM-dd");
                                        var notimestart = DateTime.Parse(notime);
                                        var notimeend = notimestart.AddDays(1);
                                        var zhengfuProjectCount = _ccontext.ZhengfuProjects.Count(x => (x.RecStatus == "A" && x.Pageurl == aaaaaaaa.pageurl) || (x.RecStatus == "A" && x.Title == aaaaaaaa.title && x.Gglx == "04" && x.NoticeTime >= notimestart && x.NoticeTime < notimeend));
                                        if (zhengfuProjectCount <= 0)
                                        {
                                            clientdtl.Timeout = TimeSpan.FromSeconds(60);
@@ -1321,7 +1585,7 @@
                                                {
                                                    var ssss = fujianya.Id;
                                                    var sssss = fujianya.InnerHtml;
                                                    fujianhtml += "<tr><td class=\"bid_attachtab_content\">附件下载:<a class=\"bizDownload\" target=\"_blank\" href =\"http://download.ccgp.gov.cn/oss/download?uuid=" + ssss + "\" id=\"0E1723104D34335C527765FF6CD28A\" title=\"点击下载\">" + sssss + "</a><br></td></tr>";
                                                    fujianhtml += "<tr><td class=\"bid_attachtab_content\">附件下载:<a class=\"bizDownload\" target=\"_blank\" href =\"https://download.ccgp.gov.cn/oss/download?uuid=" + ssss + "\" id=\"0E1723104D34335C527765FF6CD28A\" title=\"点击下载\">" + sssss + "</a><br></td></tr>";
                                                }
                                                fujianhtml += "</tbody></table></div>";
@@ -1344,8 +1608,8 @@
                                                {
                                                    if (td[i].TextContent.IndexOf("原公告的采购项目编号:") >= 0)
                                                    {
                                                        OpenTenderCode = td[i].TextContent.Replace("原公告的采购项目编号:", "").Trim();
                                                        if (string.IsNullOrEmpty(OpenTenderCode))
                                                            OpenTenderCode = td[i].TextContent.Replace("原公告的采购项目编号:", "").Trim();
                                                    }
                                                    if (td[i].TextContent.IndexOf("预算金额:") >= 0)
@@ -1477,7 +1741,7 @@
                                            _ccontext.SaveChanges();
                                            Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                                            Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                                        }
                                    }
                                }
@@ -1494,6 +1758,8 @@
                            }
                        }
                    }
                    page += 1;
                }
                catch (Exception ex)
                {
@@ -1502,10 +1768,11 @@
                    logg.WriteLog(ex.StackTrace, "中国政采网四川省");
                    logg.WriteLog(ex.ToString(), "中国政采网四川省");
                    Thread.CurrentThread.Join(1000 * 60 * 5);//阻止设定时间
                }
             
                page += 1;
              
            }
@@ -1519,7 +1786,7 @@
        //废标公告
        public static void feibiaogonggao(WebCrawlerContext _ccontext, string sichuanpageurll, string startTime, string endTime , int page)
        public static async void feibiaogonggao(WebCrawlerContext _ccontext, string sichuanpageurll, string startTime, string endTime , int page)
        {
            sichuanpageurll = sichuanpageurll.Replace("start_time=", "start_time=" + startTime.Replace("-", "%3A"));
@@ -1528,17 +1795,41 @@
            var list11 = new List<AngleSharp.Dom.IElement>();
            while (true)
            {
                Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                logg.WriteLog(page.ToString(), "中国政采网四川省");
                string sichuanpageurl2 = sichuanpageurll.Replace("page_index=1", "page_index=" + page);
                try
                {
                    using (HttpClient client = new HttpClient())
                    HttpClientHandler handler = new HttpClientHandler();
                    handler.CookieContainer = new CookieContainer();
                    using (HttpClient client = new HttpClient(handler))
                    {
                        //List<sichuanjieshoudtl> data = new List<sichuanjieshoudtl>();
                        client.Timeout = TimeSpan.FromSeconds(60);
                        client.DefaultRequestHeaders.Add("Accept", "*/*");
                        client.DefaultRequestHeaders.Add("Accept-Encoding", "gzip, deflate, br");
                        client.DefaultRequestHeaders.Add("Host", "search.ccgp.gov.cn");
                        HttpResponseMessage response = client.GetAsync(sichuanpageurl2).Result;
                        var res = response.Content.ReadAsStringAsync().Result;
                        //var res = response.Content.ReadAsStringAsync().Result;
                        string res = "";
                        if (response.IsSuccessStatusCode)
                        {
                            using (var responseStream = await response.Content.ReadAsStreamAsync())
                            {
                                using (var decompressedStream = new GZipStream(responseStream, CompressionMode.Decompress))
                                {
                                    using (var reader = new StreamReader(decompressedStream))
                                    {
                                        res = await reader.ReadToEndAsync();
                                        // 处理解压缩后的响应内容
                                    }
                                }
                            }
                        }
                        else
                        {
                            // 处理请求失败的情况
                        }
                        var document = parser.ParseDocument(res);
                        var sssdfsdfsd = document.All.Where(m => m.ClassName == "vT-srch-result-list").FirstOrDefault();
                        var contentList = sssdfsdfsd.QuerySelector("ul");
@@ -1577,13 +1868,51 @@
                                list11 = lists.ToList();
                            }
                            string[] bbb = null;
                            var scriptElements = document.QuerySelectorAll("script");
                            foreach (var scriptElement in scriptElements)
                            {
                                var scriptText = scriptElement.TextContent;
                                if (scriptText.Contains("var ohtmlurls")) // 检查文本中是否包含特定变量
                                {
                                    int startIndex = scriptText.IndexOf('"') + 1;
                                    int endIndex = scriptText.IndexOf('"', startIndex);
                                    if (startIndex > 0 && endIndex > startIndex)
                                    {
                                        var aaaa = scriptText.Substring(startIndex, endIndex - startIndex);
                                        if (!string.IsNullOrEmpty(aaaa))
                                        {
                                            bbb = aaaa.Split(',');
                                        }
                                    }
                                }
                            }
                            int ccc = 0;
                            foreach (var sichuanjieshoudtl1 in lists)
                            {
                                Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                                Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                                try
                                {
                                    sichuanjieshoudtl aaaaaaaa = new sichuanjieshoudtl();
                                    aaaaaaaa.pageurl = sichuanjieshoudtl1.QuerySelector("a").GetAttribute("href");
                                    if (bbb != null && bbb.Length >= ccc && !string.IsNullOrEmpty(bbb[ccc]))
                                    {
                                        aaaaaaaa.pageurl = bbb[ccc];
                                        ccc = ccc + 1;
                                    }
                                    else
                                    {
                                        ccc = ccc + 1;
                                        continue;
                                    }
                                    // aaaaaaaa.pageurl = sichuanjieshoudtl1.QuerySelector("a").GetAttribute("href");
                                    logg.WriteLog(aaaaaaaa.pageurl, "中国政采网四川省");
                                    aaaaaaaa.title = sichuanjieshoudtl1.QuerySelector("a").TextContent.Replace("\n", "").Trim();
@@ -1608,7 +1937,10 @@
                                    }
                                    using (HttpClient clientdtl = new HttpClient())
                                    {
                                        var zhengfuProjectCount = _ccontext.ZhengfuProjects.Count(x => (x.RecStatus == "A" && x.Pageurl == aaaaaaaa.pageurl) || (x.RecStatus == "A" && x.Title == aaaaaaaa.title && x.Gglx == "11" && x.OpenTenderTime == DateTime.Parse(NoticeTime)));
                                        var notime = DateTime.Parse(NoticeTime).ToString("yyyy-MM-dd");
                                        var notimestart = DateTime.Parse(notime);
                                        var notimeend = notimestart.AddDays(1);
                                        var zhengfuProjectCount = _ccontext.ZhengfuProjects.Count(x => (x.RecStatus == "A" && x.Pageurl == aaaaaaaa.pageurl) || (x.RecStatus == "A" && x.Title == aaaaaaaa.title && x.Gglx == "11" && x.NoticeTime >= notimestart && x.NoticeTime < notimeend));
                                        if (zhengfuProjectCount <= 0)
                                        {
                                            clientdtl.Timeout = TimeSpan.FromSeconds(60);
@@ -1630,7 +1962,7 @@
                                                {
                                                    var ssss = fujianya.Id;
                                                    var sssss = fujianya.InnerHtml;
                                                    fujianhtml += "<tr><td class=\"bid_attachtab_content\">附件下载:<a class=\"bizDownload\" target=\"_blank\" href =\"http://download.ccgp.gov.cn/oss/download?uuid=" + ssss + "\" id=\"0E1723104D34335C527765FF6CD28A\" title=\"点击下载\">" + sssss + "</a><br></td></tr>";
                                                    fujianhtml += "<tr><td class=\"bid_attachtab_content\">附件下载:<a class=\"bizDownload\" target=\"_blank\" href =\"https://download.ccgp.gov.cn/oss/download?uuid=" + ssss + "\" id=\"0E1723104D34335C527765FF6CD28A\" title=\"点击下载\">" + sssss + "</a><br></td></tr>";
                                                }
                                                fujianhtml += "</tbody></table></div>";
@@ -1653,8 +1985,8 @@
                                                {
                                                    if (td[i].TextContent.IndexOf("采购项目编号:") >= 0)
                                                    {
                                                        OpenTenderCode = td[i].TextContent.Replace("采购项目编号:", "").Trim();
                                                        if (string.IsNullOrEmpty(OpenTenderCode))
                                                            OpenTenderCode = td[i].TextContent.Replace("采购项目编号:", "").Trim();
                                                    }
                                                    if (td[i].TextContent.IndexOf("预算金额:") >= 0)
@@ -1787,7 +2119,7 @@
                                            _ccontext.SaveChanges();
                                            Thread.CurrentThread.Join(1000 * 5);//阻止设定时间
                                            Thread.CurrentThread.Join(1000 * 10);//阻止设定时间
                                        }
                                    }
                                }
@@ -1804,6 +2136,7 @@
                            }
                        }
                    }
                    page += 1;
                }
                catch (Exception ex)
                {
@@ -1812,10 +2145,11 @@
                    logg.WriteLog(ex.StackTrace, "中国政采网四川省");
                    logg.WriteLog(ex.ToString(), "中国政采网四川省");
                    Thread.CurrentThread.Join(1000 * 60 * 5);//阻止设定时间
                }
             
                page += 1;
               
            }