From 04ecf2e53539e37930e8c6a128cd8a4f51a0963e Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期一, 19 十二月 2022 14:59:57 +0800 Subject: [PATCH] 提交 --- zhengcaioa/Crawler/sichuan/CcgpSichuanoperation.cs | 47 +++++++++++++++++++++++++++++++---------------- 1 files changed, 31 insertions(+), 16 deletions(-) diff --git a/zhengcaioa/Crawler/sichuan/CcgpSichuanoperation.cs b/zhengcaioa/Crawler/sichuan/CcgpSichuanoperation.cs index 43be9ad..5b0b402 100644 --- a/zhengcaioa/Crawler/sichuan/CcgpSichuanoperation.cs +++ b/zhengcaioa/Crawler/sichuan/CcgpSichuanoperation.cs @@ -37,7 +37,7 @@ } var currPage = 1; string sichuanpageurll = ""; - Thread.CurrentThread.Join(1000 * 60 * 30);//闃绘璁惧畾鏃堕棿 + //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=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="; @@ -256,7 +256,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) @@ -621,7 +624,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); @@ -666,8 +672,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) @@ -934,7 +940,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); @@ -979,8 +988,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) { @@ -1027,8 +1036,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) { @@ -1298,7 +1307,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); @@ -1343,8 +1355,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) @@ -1610,7 +1622,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); @@ -1655,8 +1670,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) -- Gitblit v1.9.1