private bool StartBuy(long Periods, DateTime time) { this.PeriodsStartTime = DateTime.Parse(TimeUtil.DataTimeToString(time, "yyyy-MM-dd HH:mm:ss")); this.OpenData.DataPeriods = Periods; this.OpenData.strWinNum = ""; this.OpenData.WinInfo = "0,0,0"; this.OpenData.BocaiType = (int)this.BoCaiType; this.OpenData.SurplusBalance = 0L; this.OpenData.AllBalance = 0L; this.SetUpToDBOpenData(); bool result; if (!KFBoCaiDbManager.InserOpenLottery(this.OpenData)) { LogManager.WriteLog(LogTypes.Error, "[ljl_caidaxiao_猜大小] 猜大小开始购买 KFBoCaiDbManager.InserOpenLottery(data) false", null, true); result = false; } else { this.InsertHistoryData(); LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_caidaxiao_猜大小] 猜大小开启新的一轮 Periods={0}", Periods), null, true); result = true; } return(result); }
public void InitData() { try { lock (this.mutex) { this.StartTime = TimeUtil.NowDateTime(); string Periods = TimeUtil.DataTimeToString(this.StartTime, "yyMMdd"); KFBoCaiDbManager.DelTableData("t_bocai_shop", string.Format("Periods!='{0}'", Periods)); KFBoCaiDbManager.SelectBoCaiShop(Periods, out this.cacheList); } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩商店]{0}", ex.ToString()), null, true); } }
private void getShopList(GameServerClient client, int nID, byte[] cmdParams, int count) { BoCaiShopDBData msgData = new BoCaiShopDBData(); try { DateTime time = TimeUtil.NowDateTime(); string Periods = TimeUtil.DataTimeToString(time, "yyMMdd"); BoCaiDBOperator.SelectBoCaiShop(Periods, out msgData.ItemList); msgData.Flag = (null != msgData.ItemList); } catch (Exception ex) { LogManager.WriteLog(LogTypes.Exception, ex.ToString(), null, true); } client.sendCmd <BoCaiShopDBData>(nID, msgData); }
private long GetNowPeriods(DateTime time, int type) { long result; if (type == 2) { result = Convert.ToInt64(string.Format("{0}1", TimeUtil.DataTimeToString(time.AddYears(-1), "yyMMdd"))); } else if (type == 1) { result = Convert.ToInt64(string.Format("{0}001", TimeUtil.DataTimeToString(time.AddMonths(-6), "yyMMdd"))); } else { result = 0L; } return(result); }
public void LoadDataFromDB(DBManager DBMgr) { try { DateTime time = TimeUtil.NowDateTime(); string Periods = TimeUtil.DataTimeToString(time, "yyMMdd"); BoCaiDBOperator.DelData("t_bocai_shop", string.Format("Periods!='{0}'", Periods)); for (int i = 1; i < 3; i++) { long DataPeriods = this.GetNowPeriods(time, i); BoCaiDBOperator.DelData("t_bocai_open_lottery", string.Format("IsAward=1 AND BocaiType={1} AND DataPeriods < {0}", DataPeriods, i)); BoCaiDBOperator.DelData("t_bocai_buy_history", string.Format("IsSend=1 AND BocaiType={1} AND DataPeriods < {0}", DataPeriods, i)); } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true); } }
private bool StartBuy(DateTime time, long Periods, long SurplusBalance = 0L) { this.PeriodsStartTime = DateTime.Parse(TimeUtil.DataTimeToString(time, "yyyy-MM-dd HH:mm:ss")); this.OpenData.DataPeriods = Periods; this.OpenData.strWinNum = ""; this.OpenData.WinInfo = ""; this.OpenData.BocaiType = (int)this.BoCaiType; this.OpenData.SurplusBalance = SurplusBalance; this.SetUpToDBOpenData(); bool result; if (!KFBoCaiDbManager.InserOpenLottery(this.OpenData)) { LogManager.WriteLog(LogTypes.Error, "[ljl_CaiShuZi_猜数字]KFBoCaiDbManager.InserOpenLottery(data) false", null, true); result = false; } else { result = true; } return(result); }
private long GetNowPeriods(DateTime _time) { return(Convert.ToInt64(string.Format("{0}001", TimeUtil.DataTimeToString(_time, "yyMMdd")))); }
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); } }