Exemplo n.º 1
0
 private void StartServerSamePeriods(DateTime time)
 {
     try
     {
         OpenLottery data;
         KFBoCaiDbManager.SelectOpenLottery(this.MaxPeriods, (int)this.BoCaiType, out data);
         List <KFBuyBocaiData> HistoryList;
         if (null == data)
         {
             KFBoCaiDbManager.StopServer(string.Format("[ljl_CaiShuZi_猜数字] 开奖记录读取失败 BoCaiType={1},DataPeriods={0}", this.MaxPeriods, this.BoCaiType));
         }
         else if (!string.IsNullOrEmpty(data.strWinNum))
         {
             if (data.XiaoHaoDaiBi < 1)
             {
                 data.XiaoHaoDaiBi = this.OpenData.XiaoHaoDaiBi;
             }
             this.OpenData = data;
             this.SetUpToDBOpenData();
             this.PeriodsStartTime = DateTime.Parse(TimeUtil.DataTimeToString(time, "yyyy-MM-dd HH:mm:ss"));
             this.Stage            = BoCaiStageEnum.Stage_End;
             base.KFSendStageData();
             base.KFSendPeriodsData();
             LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_CaiShuZi_猜数字] 和上期是一期 并且已经开奖 BoCaiType={1},DataPeriods={0}", this.MaxPeriods, this.BoCaiType), null, true);
         }
         else if (!KFBoCaiDbManager.LoadBuyHistory((int)this.BoCaiType, this.MaxPeriods, out HistoryList))
         {
             KFBoCaiDbManager.StopServer(string.Format("[ljl_CaiShuZi_猜数字]读取购买记录失败 BoCaiType={1},DataPeriods={0}", this.MaxPeriods, this.BoCaiType));
         }
         else
         {
             this.RoleBuyDict = new Dictionary <string, List <KFBuyBocaiData> >();
             using (List <KFBuyBocaiData> .Enumerator enumerator = HistoryList.GetEnumerator())
             {
                 while (enumerator.MoveNext())
                 {
                     KFBuyBocaiData        item = enumerator.Current;
                     List <KFBuyBocaiData> itemList;
                     if (this.RoleBuyDict.TryGetValue(item.GetKey(), out itemList))
                     {
                         KFBuyBocaiData temp = itemList.Find((KFBuyBocaiData x) => x.BuyValue.Equals(item.BuyValue));
                         if (temp == null)
                         {
                             itemList.Add(item);
                         }
                         else
                         {
                             temp.BuyNum += item.BuyNum;
                         }
                     }
                     else
                     {
                         itemList = new List <KFBuyBocaiData>();
                         itemList.Add(item);
                         this.RoleBuyDict.Add(item.GetKey(), itemList);
                     }
                 }
             }
             if (data.XiaoHaoDaiBi < 1)
             {
                 data.XiaoHaoDaiBi = this.OpenData.XiaoHaoDaiBi;
             }
             this.OpenData         = data;
             this.PeriodsStartTime = DateTime.Parse(TimeUtil.DataTimeToString(time, "yyyy-MM-dd HH:mm:ss"));
             this.SetUpToDBOpenData();
             if (DateTime.Parse(this.Config.KaiJiangShiJian) >= time)
             {
                 this.Stage = BoCaiStageEnum.Stage_Buy;
                 LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_CaiShuZi_猜数字] 和上期是一期 并且没开奖 BoCaiType={1},DataPeriods={0}", this.MaxPeriods, this.BoCaiType), null, true);
             }
             else if ((DateTime.Parse("23:59:59") - time).TotalMinutes < 2.0)
             {
                 this.Stage = BoCaiStageEnum.Stage_Open;
                 this.SetUpToDBOpenData();
                 LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_CaiShuZi_猜数字] 和上期是一期 状态设置开奖 &&强制开奖 不足2分钟 BoCaiType={1},DataPeriods={0}", this.MaxPeriods, this.BoCaiType), null, true);
                 this.Thread();
             }
             else
             {
                 this.Stage = BoCaiStageEnum.Stage_Open;
                 LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_CaiShuZi_猜数字] 和上期是一期 状态设置开奖 BoCaiType={1},DataPeriods={0}", this.MaxPeriods, this.BoCaiType), null, true);
             }
             base.KFSendStageData();
             base.KFSendPeriodsData();
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_CaiShuZi_猜数字]{0}", ex.ToString()), null, true);
     }
 }