zx 6 rokov pred
rodič
commit
a6277a00e1

+ 176 - 0
FCS.Crawler/Content/UpdateService/UpdateJobs/UpdateJob.cs

@@ -85,5 +85,181 @@ namespace FCS.Crawler
 
 
     }
+    public class Update_Odd : CommonJob
+    {
+        List<DataItemDetail> bankerCompanyList = new List<DataItemDetail>();
+        List<BankerCompanyRelation> relationList = new List<BankerCompanyRelation>();
+        Dictionary<string, string> bankerCompanyType = new Dictionary<string, string>();
+        List<BankerCompany> companyList = new List<BankerCompany>();
+        List<F_Compensate> compList = new List<F_Compensate>();
+        string jishi, kaili, fanhuan, gailv;
+        List<company5List> jishiList;
+
+        public Update_Odd()
+        {
+            bankerCompanyList = services.GetDataItem(DataItemDetailEnum.BankerCompanyType);
+            var compTypeList = services.GetDataItem(DataItemDetailEnum.FootBallEuropeOddsType);
+            jishi = compTypeList.Where(p => p.Name.Contains("即时赔率")).ToList()[0].Id;
+            kaili = compTypeList.Where(p => p.Name.Contains("凯利指数")).ToList()[0].Id;
+            fanhuan = compTypeList.Where(p => p.Name.Contains("返还率")).ToList()[0].Id;
+            gailv = compTypeList.Where(p => p.Name.Contains("概率")).ToList()[0].Id;
+        }
+
+        public void OddJob()
+        {
+
+            var gameList = services.Query<F_Games>($" AND StartDateTime BETWEEN {DateTime.Now.AddDays(-10).ToString("yyyy-MM-dd")} AND {DateTime.Now.AddDays(10).ToString("yyyy-MM-dd")}", "", "a.Id,a.Remark").ToList();
+            gameList.ForEach(p =>
+            {
+                taskList.Add(Task.Run(() =>
+                {
+                    var url = " http://fenxi.zgzcw.com/{0}/bjop".FormatMe(p.Remark.Split('/')[p.Remark.Split('/').Length - 2]);
+                    var doc = CommonHelper.GetHtmlHtmlDocument(new HtmlParameterDTO { Url = url, Timeout = 10000, NotIpNumber = 100, Title = "足彩" });
+                    var makeBallRanking = doc.DocumentNode.SelectSingleNode(".//[@id='com-type']").SelectNodes(".//option");
+                    GetDictType(makeBallRanking);//获取类型
+
+
+                    var table = doc.DocumentNode.SelectSingleNode(".//[@id='data-body']").SelectNodes(".//table");
+                    foreach (var tableItem in table)
+                    {
+                        var tr = tableItem.SelectNodes(".//tr");
+                        foreach (var trItem in tr)
+                        {
+                            var td = trItem.SelectNodes(".//td");
+                            compList.Add(new F_Compensate
+                            {
+                                BankerCompanyId = GetBankerCompany(td[1].InnerText, td[1].Attributes["data"].Value, url),
+                                GameId = p.Id,
+                                Remark = url,
+                                SOdd = double.Parse(td[2].InnerText),
+                                POdd = double.Parse(td[3].InnerText),
+                                FOdd = double.Parse(td[4].InnerText),
+                                CompensateType = jishi,
+                                ChangeDateTime = DateTime.Parse("2001-01-01"),
+                                CreateDateTime = DateTime.Now,
+
+                            });
+                            compList.Add(new F_Compensate
+                            {
+                                BankerCompanyId = GetBankerCompany(td[1].InnerText, td[1].Attributes["data"].Value, url),
+                                GameId = p.Id,
+                                Remark = url,
+                                SOdd = double.Parse(td[9].InnerText),
+                                POdd = double.Parse(td[10].InnerText),
+                                FOdd = double.Parse(td[11].InnerText),
+                                CompensateType = gailv,
+                                ChangeDateTime = DateTime.Parse("2001-01-01"),
+                                CreateDateTime = DateTime.Now,
+
+                            });
+                            compList.Add(new F_Compensate
+                            {
+                                BankerCompanyId = GetBankerCompany(td[1].InnerText, td[1].Attributes["data"].Value, url),
+                                GameId = p.Id,
+                                Remark = url,
+                                SOdd = double.Parse(td[12].InnerText),
+                                POdd = double.Parse(td[13].InnerText),
+                                FOdd = double.Parse(td[14].InnerText),
+                                CompensateType = gailv,
+                                ChangeDateTime = DateTime.Now,
+                                CreateDateTime = DateTime.Now,
+
+                            });
+                            compList.Add(new F_Compensate
+                            {
+                                BankerCompanyId = GetBankerCompany(td[1].InnerText, td[1].Attributes["data"].Value, url),
+                                GameId = p.Id,
+                                Remark = url,
+                                SOdd = double.Parse(td[15].InnerText),
+                                CompensateType = fanhuan,
+                                ChangeDateTime = DateTime.Now,
+                                CreateDateTime = DateTime.Now,
+
+                            });
+                            GetCompensate_JS(new F_Compensate
+                            {
+                                BankerCompanyId = GetBankerCompany(td[1].InnerText, td[1].Attributes["data"].Value, url),
+                                GameId = p.Id,
+                                Remark = url,
+                            }, td[1].InnerText);
+                        }
+                    }
+                }));
+
+            });
+            Task.WaitAll(taskList.ToArray());
+            var aa = compList;
+        }
+
+        public void GetCompensate_JS(F_Compensate model, string bankerCompanyName)
+        {
+            if (jishiList.IsEmpty())
+            {
+                var url = " http://fenxi.zgzcw.com/{0}/bjop".FormatMe(model.Remark.Split('/')[model.Remark.Split('/').Length - 2]);
+                var doc = CommonHelper.GetHtmlString(new HtmlParameterDTO { Url = url, Timeout = 10000, NotIpNumber = 100, Title = "足彩" });
+                var obj = JsonConvert.DeserializeObject<JObject>(doc);
+                jishiList = JsonConvert.DeserializeObject<List<company5List>>(obj["company5List"].ToString());
+            }
 
+
+            var objw1 = jishiList.Where(a => a.attribute.name == bankerCompanyName).FirstOrDefault();
+            if (objw1 == null)
+                return;
+            foreach (var item in objw1.c)
+            {
+                var data = item.attribute;
+                compList.Add(new F_Compensate
+                {
+                    Id = CommonHelper.GetGuid().ToString(),
+                    GameId = model.GameId,
+                    Remark = model.Remark,
+                    BankerCompanyId = model.BankerCompanyId,
+                    CreateDateTime = DateTime.Now,
+                    ChangeDateTime = item.attribute.wdate.TryToDateTime(),
+                    SOdd = Convert.ToDouble(item.attribute.win),
+                    POdd = Convert.ToDouble(item.attribute.same),
+                    FOdd = Convert.ToDouble(item.attribute.lost),
+                    CompensateType = jishi,
+                });
+
+
+            }
+
+        }
+
+        public string GetBankerCompany(string name, string typeName, string url)
+        {
+            var id = CommonHelper.GetGuid().ToString();
+            companyList.Add(new BankerCompany
+            {
+                Name = name,
+                CreateDateTime = DateTime.Now,
+                Id = id,
+                Remark = url
+
+            });
+            return id;
+        }
+
+        public void GetMakeBallRanking(string id, string type)
+        {
+            var name = bankerCompanyType[type];
+            relationList.Add(new BankerCompanyRelation
+            {
+                Id = CommonHelper.GetGuid().ToString(),
+                CreateDateTime = DateTime.Now,
+                BankerCompanyId = id,
+                BankerCompanyType = bankerCompanyList.Where(p => p.Name == name).ToList()[0].Id,
+                Remark = name,
+            });
+        }
+
+        public void GetDictType(HtmlNodeCollection data)
+        {
+            foreach (var item in data)
+            {
+                bankerCompanyType.Add(item.Attributes["value"].Value, item.InnerText);
+            }
+        }
+    }
 }

+ 0 - 1
FCS.Crawler/Content/UpdateService/UpdateJobs/Update_RealTimeJob.cs

@@ -39,7 +39,6 @@ namespace FCS.Crawler
 
             ThreadPool.SetMaxThreads(200, 200);
             CommonHelper.LogBD("开始Update_RealTime", logName);
-            CommonHelper.LogBD("IP更新完成", logName);
             new GamesJob().Click();
             CommonHelper.LogBD("比赛完成", logName);
             taskList.Add(Task.Run(() =>

+ 7 - 7
FCS.Crawler/Program.cs

@@ -28,13 +28,13 @@ namespace FCS.Crawler
         /// </summary>
         private static void Main()
         {
-            ServiceBase[] ServicesToRun;
-            ServicesToRun = new ServiceBase[]
-             {
-                       new Service1()
-              };
-            ServiceBase.Run(ServicesToRun);
-
+            //ServiceBase[] ServicesToRun;
+            //ServicesToRun = new ServiceBase[]
+            // {
+            //           new Service1()
+            //  };
+            //ServiceBase.Run(ServicesToRun);
+            new Update_RealTimeJob().Click();
         }