Ejemplo n.º 1
0
        private List <long> InitMatchList()
        {
            //取有賠率與走地的賽事編號
            var matches  = new List <long>();
            var matchStr = CacheService.GetInitMatchList();

            if (!string.IsNullOrEmpty(matchStr))
            {
                matches = JsonConvert.DeserializeObject <List <long> >(matchStr);
            }
            else
            {
                var scoutMatchIds = DataSave.FetchLiveScout();
                var oddsMatchIds  = DataSave.FetchOdds();
                foreach (var matchId in oddsMatchIds)
                {
                    foreach (var scoutMatchId in scoutMatchIds)
                    {
                        if (matchId > 0 && matchId == scoutMatchId && !matches.Contains(matchId))
                        {
                            matches.Add(matchId);
                        }
                    }
                }
                CacheService.SetInitMatchList(matches, false);
            }
            return(matches);
        }
Ejemplo n.º 2
0
        public MatchV1(long matchId, int totaltime)
        {
            //先結算上一場賽事的單
            DataSave.DoSettle(matchId, 1); //全場
            DataSave.DoSettle(matchId, 2); //半場

            Scout = DataSave.FetchLiveScout(matchId);
            Odds  = DataSave.FetchOdds(matchId);

            MatchId = matchId;

            var totalMiSec = totaltime * 60 * 1000;

            //基本上賠率資料會大於動畫資料
            modTimeForOdds = totalMiSec % (Odds.Length - 1);
            avgTimeForOdds = totalMiSec / (Odds.Length - 1);

            modIndex = (Odds.Length - 1) % (Scout.Length - 2);
            avgIndex = ((Odds.Length - 1) - modIndex) / (Scout.Length - 2);
        }
Ejemplo n.º 3
0
        public Match(long matchId, int totaltime)
        {
            //先結算上一場賽事的單
            DataSave.DoSettle(matchId, 1); //全場
            DataSave.DoSettle(matchId, 2); //半場

            RiskOddsDataList = new List <RiskData>();
            Scout            = DataSave.FetchLiveScout(matchId);
            Odds             = DataSave.FetchOdds(matchId);
            long tempMsgnr = -1L;

            #region 組批次檔
            RiskData      rData = new RiskData();
            LiveMatchData lData = new LiveMatchData();
            for (int i = 0; i < Odds.Length; i++)
            {
                var tmpOddsTypeId = long.Parse(string.IsNullOrEmpty(Odds[i].OddsTypeID) ? "0" : Odds[i].OddsTypeID);
                var tmpSubtype    = long.Parse(string.IsNullOrEmpty(Odds[i].Subtype) ? "0" : Odds[i].Subtype);
                if (Odds[i].MsgNr == tempMsgnr)
                {
                    //RiskMan 如果有不同的 TypeId & SubType 要新增
                    bool isNeedToInsert = true;
                    foreach (var typeIdList in rData.OddsTypeIdList)
                    {
                        if (typeIdList.OddsTypeId == tmpOddsTypeId &&
                            typeIdList.SubType == tmpSubtype)
                        {
                            isNeedToInsert = false;
                            break;
                        }
                    }

                    if (isNeedToInsert)
                    {
                        rData.OddsTypeIdList.Add(
                            new OddsTypeIdList()
                        {
                            OddsTypeId = tmpOddsTypeId,
                            SubType    = tmpSubtype
                        }
                            );
                    }

                    rData.OddsTypeIdList.Where(x => x.OddsTypeId == tmpOddsTypeId && x.SubType == tmpSubtype).First().OddsChangeList.Add(
                        new OddsChangeList()
                    {
                        OddsId          = Odds[i].OddsId,
                        OddsIdOri       = Odds[i].OddsIdOri.ToString(),
                        Odds            = Odds[i].Odds.ToString(),
                        SpecialBetValue = Odds[i].SpecialBetValue,
                        ForTheRest      = Odds[i].ForTheRest,
                        Score           = Odds[i].Score,
                        Status          = 1,
                        Timestamp       = Odds[i].CreateTime
                    });

                    if (i == Odds.Length - 1)
                    {
                        RiskOddsDataList.Add(rData);
                    }
                }
                else
                {
                    if (i != 0)
                    {
                        RiskOddsDataList.Add(rData);
                        rData = new RiskData();
                    }
                    tempMsgnr      = Odds[i].MsgNr;
                    rData.MatchId  = Odds[i].MatchId;
                    rData.Msgnr    = Odds[i].MsgNr;
                    rData.Source   = 1;
                    rData.OddsKind = 2;
                    //RiskMan 如果有不同的 TypeId & SubType 要新增
                    bool isNeedToInsert = true;
                    foreach (var typeIdList in rData.OddsTypeIdList)
                    {
                        if (typeIdList.OddsTypeId == tmpOddsTypeId &&
                            typeIdList.SubType == tmpSubtype)
                        {
                            isNeedToInsert = false;
                            break;
                        }
                    }

                    if (isNeedToInsert)
                    {
                        rData.OddsTypeIdList.Add(
                            new OddsTypeIdList()
                        {
                            OddsTypeId = tmpOddsTypeId,
                            SubType    = tmpSubtype
                        }
                            );
                    }

                    rData.OddsTypeIdList.Where(x => x.OddsTypeId == tmpOddsTypeId && x.SubType == tmpSubtype).First().OddsChangeList.Add(
                        new OddsChangeList()
                    {
                        OddsId          = Odds[i].OddsId,
                        OddsIdOri       = Odds[i].OddsIdOri.ToString(),
                        Odds            = Odds[i].Odds.ToString(),
                        SpecialBetValue = Odds[i].SpecialBetValue,
                        ForTheRest      = Odds[i].ForTheRest,
                        Score           = Odds[i].Score,
                        Status          = 1,
                        Timestamp       = Odds[i].CreateTime
                    });
                }
            }

            #endregion

            MatchId = matchId;

            var totalMiSec = totaltime * 60 * 1000;

            modTimeForOddsRisk = totalMiSec % RiskOddsDataList.Count;
            avgTimeForOddsRisk = totalMiSec / RiskOddsDataList.Count;

            modTimeForOdds = totalMiSec % Odds.Length;
            avgTimeForOdds = totalMiSec / Odds.Length;

            modTimeForScout = totalMiSec % Scout.Length;
            avgTimeForScout = totalMiSec / Scout.Length;
        }