コード例 #1
0
 protected override void Init()
 {
     try
     {
         lock (this.mutex)
         {
             long delDataPeriods = this.GetNowPeriods(TimeUtil.NowDateTime().AddMonths(-6));
             KFBoCaiDbManager.DelTableData("t_bocai_open_lottery", string.Format("BocaiType={1} AND DataPeriods < {0}", delDataPeriods, (int)this.BoCaiType));
             KFBoCaiDbManager.DelTableData("t_bocai_buy_history", string.Format("BocaiType={1} AND DataPeriods < {0}", delDataPeriods, (int)this.BoCaiType));
             this.InitConfig();
             KFBoCaiDbManager.SelectOpenLottery((int)this.BoCaiType, this.SelectOpenHisttory10, out this.OpenHistory);
             List <KFBoCaoHistoryData> HistoryList = new List <KFBoCaoHistoryData>();
             KFBoCaiDbManager.LoadLotteryHistory(this.BoCaiType, out HistoryList, "LIMIT 50");
             this.addHistory(HistoryList);
             this.MaxPeriods = KFBoCaiDbManager.GetMaxPeriods((int)this.BoCaiType);
             if (this.MaxPeriods < 0L)
             {
                 KFBoCaiDbManager.StopServer("[ljl_caidaxiao_猜大小] 猜大小 maxPeriods == -1");
             }
             else
             {
                 if (null == this.Config)
                 {
                     LogManager.WriteLog(LogTypes.Error, "[ljl_caidaxiao_猜大小]猜大小配置文件错误", null, true);
                 }
                 this.Stage = BoCaiStageEnum.Stage_Ready;
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_caidaxiao_猜大小]{0}", ex.ToString()), null, true);
         KFBoCaiDbManager.StopServer("初始化 Exception");
     }
 }
コード例 #2
0
ファイル: KFBoCaiCaiShuzi.cs プロジェクト: qiuhoude/mu_server
 protected override void Init()
 {
     try
     {
         lock (this.mutex)
         {
             DateTime _time          = TimeUtil.NowDateTime();
             long     delDataPeriods = this.GetNowPeriods(_time.AddYears(-1));
             KFBoCaiDbManager.DelTableData("t_bocai_open_lottery", string.Format("BocaiType={1} AND DataPeriods < {0}", delDataPeriods, (int)this.BoCaiType));
             KFBoCaiDbManager.DelTableData("t_bocai_buy_history", string.Format("BocaiType={1} AND DataPeriods < {0}", delDataPeriods, (int)this.BoCaiType));
             this.InitConfig();
             KFBoCaiDbManager.LoadLotteryHistory(this.BoCaiType, out this.BoCaiWinHistoryList, "");
             KFBoCaiDbManager.SelectOpenLottery((int)this.BoCaiType, this.SelectOpenHisttory10, out this.OpenHistory);
             this.MaxPeriods = KFBoCaiDbManager.GetMaxPeriods((int)this.BoCaiType);
             if (this.MaxPeriods < 0L)
             {
                 KFBoCaiDbManager.StopServer("[ljl_caidaxiao_猜数字] 猜数字 maxPeriods == -1");
             }
             else
             {
                 if (null == this.Config)
                 {
                     LogManager.WriteLog(LogTypes.Error, "[ljl_CaiShuZi_猜数字]猜数字配置文件错误", null, true);
                 }
                 else if (DateTime.Parse(this.Config.KaiQiShiJian) < _time)
                 {
                     long Periods = this.GetNowPeriods(_time);
                     if (this.MaxPeriods == Periods)
                     {
                         this.StartServerSamePeriods(_time);
                         return;
                     }
                 }
                 else
                 {
                     LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_CaiShuZi_猜数字] 未开启 开启时间 {0}", this.Config.KaiQiShiJian), null, true);
                 }
                 this.GetOldBalance();
                 this.Stage = BoCaiStageEnum.Stage_Ready;
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_CaiShuZi_猜数字]{0}", ex.ToString()), null, true);
         KFBoCaiDbManager.StopServer("初始化 Exception");
     }
 }