Esempio n. 1
0
        private void DownloadDetailOdds(GameInfo game, string tableName, IEnumerable <int> companies)
        {
            bool          flag  = false;
            List <string> list1 = new List <string>();

            foreach (int num in companies)
            {
                string url = string.Format("http://live.aicai.com/xiyaou/odds!getOddsTrack.htm?betId={0}&companyId={1}", (object)game.GameId, (object)num);
                string str = this.RetrieveText(url);
                if (str.Contains("fail"))
                {
                    list1.Add(num.ToString());
                    System.IO.File.AppendAllText("C:\\Users\\dxiao1\\Desktop\\Data\\log_sina.txt", string.Format("Getting Data Failure, url: {0}\r\n", (object)url));
                }
                else
                {
                    List <OddsInfo> list2 = new List <OddsInfo>();
                    object          obj1  = JsonConvert.DeserializeObject(str);
                    // ISSUE: reference to a compiler-generated field
                    if (DownloadSinaDailyBll.\u003CDownloadDetailOdds\u003Eo__SiteContainerc.\u003C\u003Ep__Sited == null)
                    {
                        // ISSUE: reference to a compiler-generated field
                        DownloadSinaDailyBll.\u003CDownloadDetailOdds\u003Eo__SiteContainerc.\u003C\u003Ep__Sited = CallSite <Func <CallSite, object, IEnumerable> > .Create(Binder.Convert(CSharpBinderFlags.None, typeof(IEnumerable), typeof(DownloadSinaDailyBll)));
                    }
                    // ISSUE: reference to a compiler-generated field
                    Func <CallSite, object, IEnumerable> func = DownloadSinaDailyBll.\u003CDownloadDetailOdds\u003Eo__SiteContainerc.\u003C\u003Ep__Sited.Target;
                    // ISSUE: reference to a compiler-generated field
                    CallSite <Func <CallSite, object, IEnumerable> > callSite = DownloadSinaDailyBll.\u003CDownloadDetailOdds\u003Eo__SiteContainerc.\u003C\u003Ep__Sited;
                    // ISSUE: reference to a compiler-generated field
                    if (DownloadSinaDailyBll.\u003CDownloadDetailOdds\u003Eo__SiteContainerc.\u003C\u003Ep__Sitee == null)
                    {
                        // ISSUE: reference to a compiler-generated field
                        DownloadSinaDailyBll.\u003CDownloadDetailOdds\u003Eo__SiteContainerc.\u003C\u003Ep__Sitee = CallSite <Func <CallSite, object, object> > .Create(Binder.GetMember(CSharpBinderFlags.None, "Root", typeof(DownloadSinaDailyBll), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[1]
                        {
                            CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null)
                        }));
                    }
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    object obj2 = DownloadSinaDailyBll.\u003CDownloadDetailOdds\u003Eo__SiteContainerc.\u003C\u003Ep__Sitee.Target((CallSite)DownloadSinaDailyBll.\u003CDownloadDetailOdds\u003Eo__SiteContainerc.\u003C\u003Ep__Sitee, obj1);
                    foreach (object obj3 in func((CallSite)callSite, obj2))
                    {
                        // ISSUE: reference to a compiler-generated field
                        if (DownloadSinaDailyBll.\u003CDownloadDetailOdds\u003Eo__SiteContainerc.\u003C\u003Ep__Sitef == null)
                        {
                            // ISSUE: reference to a compiler-generated field
                            DownloadSinaDailyBll.\u003CDownloadDetailOdds\u003Eo__SiteContainerc.\u003C\u003Ep__Sitef = CallSite <Func <CallSite, object, JProperty> > .Create(Binder.Convert(CSharpBinderFlags.ConvertExplicit, typeof(JProperty), typeof(DownloadSinaDailyBll)));
                        }
                        // ISSUE: reference to a compiler-generated field
                        // ISSUE: reference to a compiler-generated field
                        JProperty jproperty = DownloadSinaDailyBll.\u003CDownloadDetailOdds\u003Eo__SiteContainerc.\u003C\u003Ep__Sitef.Target((CallSite)DownloadSinaDailyBll.\u003CDownloadDetailOdds\u003Eo__SiteContainerc.\u003C\u003Ep__Sitef, obj3);
                        if (!(jproperty.Name != "result"))
                        {
                            foreach (JToken jtoken in (IEnumerable <JToken>)((JProperty)jproperty.Value.First).Value)
                            {
                                OddsInfo oddsInfo = new OddsInfo();
                                oddsInfo.CompanyId = Convert.ToInt32(num);
                                oddsInfo.GameId    = game.GameId;
                                foreach (JProperty data in (IEnumerable <JToken>)jtoken)
                                {
                                    if (data.Name == "createTime")
                                    {
                                        oddsInfo.UpdateTime = this.RetrieveUpdateTime(data);
                                    }
                                    else if (data.Name == "drowOdds")
                                    {
                                        oddsInfo.Tie = Convert.ToDecimal(data.Value.ToString()) / new Decimal(10000);
                                    }
                                    else if (data.Name == "loseOdds")
                                    {
                                        oddsInfo.Lose = Convert.ToDecimal(data.Value.ToString()) / new Decimal(10000);
                                    }
                                    else if (data.Name == "winOdds")
                                    {
                                        oddsInfo.Win = Convert.ToDecimal(data.Value.ToString()) / new Decimal(10000);
                                    }
                                }
                                list2.Add(oddsInfo);
                            }
                        }
                    }
                    if (list2.Count > 0)
                    {
                        DataHandler500.SaveOddsInfo((IEnumerable <OddsInfo>)list2, tableName);
                    }
                    else
                    {
                        flag = true;
                        break;
                    }
                }
            }
            if (flag)
            {
                DataHandlerSina.UpdateDataReady(game.GameId, DataReady.YesSimpleNoDetail);
            }
            else if (list1.Count > 0)
            {
                DataHandlerSina.UpdateFailureIds(game.GameId, string.Join(",", (IEnumerable <string>)list1));
                if (list1.Count != Enumerable.Count <int>(companies))
                {
                    return;
                }
                System.IO.File.AppendAllText("C:\\Users\\dxiao1\\Desktop\\Data\\log_sina.txt", string.Format("-------Data is missing, id: {0}-------\r\n", (object)game.GameId));
            }
            else
            {
                DataHandlerSina.UpdateDataReady(game.GameId, DataReady.YesAll);
            }
        }
Esempio n. 2
0
        private List <int> RetrieveOdds(GameInfo game, Dictionary <int, DateTime> maxUpdateTimes, bool updateGameInfo, bool downloadHistory)
        {
            string          str1  = this.RetrieveText(string.Format("http://live.aicai.com/xiyaou/odds!getOuzhi.htm?betId={0}&propId=0&start=0&size=9999", (object)game.GameId));
            List <int>      list1 = new List <int>();
            List <int>      list2 = new List <int>();
            List <OddsInfo> list3 = new List <OddsInfo>();
            object          obj1  = JsonConvert.DeserializeObject(str1);

            // ISSUE: reference to a compiler-generated field
            if (DownloadSinaDailyBll.\u003CRetrieveOdds\u003Eo__SiteContainer8.\u003C\u003Ep__Site9 == null)
            {
                // ISSUE: reference to a compiler-generated field
                DownloadSinaDailyBll.\u003CRetrieveOdds\u003Eo__SiteContainer8.\u003C\u003Ep__Site9 = CallSite <Func <CallSite, object, IEnumerable> > .Create(Binder.Convert(CSharpBinderFlags.None, typeof(IEnumerable), typeof(DownloadSinaDailyBll)));
            }
            // ISSUE: reference to a compiler-generated field
            Func <CallSite, object, IEnumerable> func = DownloadSinaDailyBll.\u003CRetrieveOdds\u003Eo__SiteContainer8.\u003C\u003Ep__Site9.Target;
            // ISSUE: reference to a compiler-generated field
            CallSite <Func <CallSite, object, IEnumerable> > callSite = DownloadSinaDailyBll.\u003CRetrieveOdds\u003Eo__SiteContainer8.\u003C\u003Ep__Site9;

            // ISSUE: reference to a compiler-generated field
            if (DownloadSinaDailyBll.\u003CRetrieveOdds\u003Eo__SiteContainer8.\u003C\u003Ep__Sitea == null)
            {
                // ISSUE: reference to a compiler-generated field
                DownloadSinaDailyBll.\u003CRetrieveOdds\u003Eo__SiteContainer8.\u003C\u003Ep__Sitea = CallSite <Func <CallSite, object, object> > .Create(Binder.GetMember(CSharpBinderFlags.None, "Root", typeof(DownloadSinaDailyBll), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[1]
                {
                    CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null)
                }));
            }
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            object obj2 = DownloadSinaDailyBll.\u003CRetrieveOdds\u003Eo__SiteContainer8.\u003C\u003Ep__Sitea.Target((CallSite)DownloadSinaDailyBll.\u003CRetrieveOdds\u003Eo__SiteContainer8.\u003C\u003Ep__Sitea, obj1);

            foreach (object obj3 in func((CallSite)callSite, obj2))
            {
                // ISSUE: reference to a compiler-generated field
                if (DownloadSinaDailyBll.\u003CRetrieveOdds\u003Eo__SiteContainer8.\u003C\u003Ep__Siteb == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    DownloadSinaDailyBll.\u003CRetrieveOdds\u003Eo__SiteContainer8.\u003C\u003Ep__Siteb = CallSite <Func <CallSite, object, JProperty> > .Create(Binder.Convert(CSharpBinderFlags.ConvertExplicit, typeof(JProperty), typeof(DownloadSinaDailyBll)));
                }
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                JProperty jproperty = DownloadSinaDailyBll.\u003CRetrieveOdds\u003Eo__SiteContainer8.\u003C\u003Ep__Siteb.Target((CallSite)DownloadSinaDailyBll.\u003CRetrieveOdds\u003Eo__SiteContainer8.\u003C\u003Ep__Siteb, obj3);
                if (!(jproperty.Name != "result"))
                {
                    string leagueId = string.Empty;
                    foreach (JProperty data1 in (IEnumerable <JToken>)jproperty.Value)
                    {
                        if (data1.Name == "matchTime")
                        {
                            game.GameTime = this.RetrieveUpdateTime(data1);
                        }
                        else if (data1.Name == "leagueId")
                        {
                            leagueId = data1.Value.ToString();
                        }
                        else if (data1.Name == "hostRank")
                        {
                            game.HostRank = data1.Value.ToString().Replace("\"", "");
                        }
                        else if (data1.Name == "awayRank")
                        {
                            game.GuestRank = data1.Value.ToString().Replace("\"", "");
                        }
                        if (updateGameInfo || downloadHistory)
                        {
                            if (data1.Name == "hostHalfScore")
                            {
                                game.HalfScore = data1.Value.ToString();
                            }
                            else if (data1.Name == "hostScore")
                            {
                                game.FinalScore = data1.Value.ToString();
                            }
                            else if (data1.Name == "awayHalfScore")
                            {
                                GameInfo gameInfo = game;
                                string   str2     = gameInfo.HalfScore + "-" + data1.Value.ToString();
                                gameInfo.HalfScore = str2;
                            }
                            else if (data1.Name == "awayScore")
                            {
                                GameInfo gameInfo = game;
                                string   str2     = gameInfo.FinalScore + "-" + data1.Value.ToString();
                                gameInfo.FinalScore = str2;
                            }
                        }
                        if (!(data1.Name != "europOddsList"))
                        {
                            if (updateGameInfo)
                            {
                                DataHandlerSina.UpdateDailyGameInfo(game, "FootballSinaDaily");
                                return(list1);
                            }
                            foreach (JToken jtoken in (IEnumerable <JToken>)data1.Value)
                            {
                                OddsInfo oddsInfo1 = new OddsInfo();
                                OddsInfo oddsInfo2 = new OddsInfo();
                                oddsInfo1.GameId = game.GameId;
                                oddsInfo2.GameId = game.GameId;
                                foreach (JProperty data2 in (IEnumerable <JToken>)jtoken)
                                {
                                    if (data2.Name == "createTime")
                                    {
                                        oddsInfo2.UpdateTime = this.RetrieveUpdateTime(data2);
                                    }
                                    else if (data2.Name == "drowOdds")
                                    {
                                        oddsInfo1.Tie = Convert.ToDecimal(data2.Value.ToString()) / new Decimal(10000);
                                    }
                                    else if (data2.Name == "loseOdds")
                                    {
                                        oddsInfo1.Lose = Convert.ToDecimal(data2.Value.ToString()) / new Decimal(10000);
                                    }
                                    else if (data2.Name == "winOdds")
                                    {
                                        oddsInfo1.Win = Convert.ToDecimal(data2.Value.ToString()) / new Decimal(10000);
                                    }
                                    else if (data2.Name == "companyId")
                                    {
                                        oddsInfo1.CompanyId = Convert.ToInt32(data2.Value.ToString());
                                        oddsInfo2.CompanyId = oddsInfo1.CompanyId;
                                        if (oddsInfo1.CompanyId != 28 && oddsInfo1.CompanyId != 31 && (oddsInfo1.CompanyId != 45 && oddsInfo1.CompanyId != 59) && oddsInfo1.CompanyId != 65)
                                        {
                                            list2.Add(oddsInfo1.CompanyId);
                                        }
                                    }
                                    else if (data2.Name == "lastUpdateTime")
                                    {
                                        oddsInfo1.UpdateTime = this.RetrieveUpdateTime(data2);
                                    }
                                    else if (data2.Name == "firstDrowOdds")
                                    {
                                        oddsInfo2.Tie = Convert.ToDecimal(data2.Value.ToString()) / new Decimal(10000);
                                    }
                                    else if (data2.Name == "firstLoseOdds")
                                    {
                                        oddsInfo2.Lose = Convert.ToDecimal(data2.Value.ToString()) / new Decimal(10000);
                                    }
                                    else if (data2.Name == "firstWinOdds")
                                    {
                                        oddsInfo2.Win = Convert.ToDecimal(data2.Value.ToString()) / new Decimal(10000);
                                    }
                                }
                                if (maxUpdateTimes != null && maxUpdateTimes.ContainsKey(oddsInfo1.CompanyId) && maxUpdateTimes[oddsInfo1.CompanyId] < oddsInfo1.UpdateTime)
                                {
                                    list1.Add(oddsInfo1.CompanyId);
                                }
                                if (oddsInfo2.CompanyId != 28 && oddsInfo2.CompanyId != 31 && (oddsInfo2.CompanyId != 45 && oddsInfo2.CompanyId != 59) && oddsInfo2.CompanyId != 65)
                                {
                                    list3.Add(oddsInfo2);
                                }
                            }
                        }
                    }
                    if (list3.Count > 0 && maxUpdateTimes == null)
                    {
                        DataHandlerSina.SaveDailyGameInfo(game, leagueId, "FootballSinaDaily");
                        DataHandler500.SaveOddsInfo((IEnumerable <OddsInfo>)list3, "FootballSinaDaily.dbo.OddsInfo_Daily");
                    }
                }
            }
            if (list3.Count > 0 && maxUpdateTimes == null)
            {
                DataHandlerSina.SaveGameCompanyMap(game.GameId, string.Join <int>(",", (IEnumerable <int>)list2), "FootballSinaDaily");
                DataHandlerSina.UpdateDataReady(game.GameId, DataReady.YesSimpleNotDetail, "FootballSinaDaily");
            }
            return(list1);
        }