Beispiel #1
0
 private bool ReturnItem(OpenLottery data, BuyBoCai2SDB buyItem)
 {
     try
     {
         buyItem.IsSend = true;
         BoCaiBuy2DBList.getInstance().AddData(buyItem, 0, false);
         if (!"True".Equals(Global.Send2DB <BuyBoCai2SDB>(2082, buyItem, 0)))
         {
             LogManager.WriteLog(LogTypes.Warning, string.Format("[ljl_博彩]更新数据库标志失败,返回道具,没关系 线程会自动处理旧数据,{0},{1}", buyItem.m_RoleName, buyItem.DataPeriods), null, true);
             return(false);
         }
         int    returnNum = buyItem.BuyNum * data.XiaoHaoDaiBi;
         string strTitle  = "猜大小";
         if (buyItem.BocaiType == 2)
         {
             strTitle = "猜数字";
         }
         string           strIntro  = string.Format("因系统维护原因导致{0}期{1}玩法没有正常开奖,系统将返还您当期下注的欢乐代币。", buyItem.DataPeriods, strTitle);
         List <GoodsData> goodsData = new List <GoodsData>
         {
             HuanLeDaiBiManager.GetInstance().GetHuanLeDaiBi(returnNum)
         };
         return(this.SendMail(buyItem, goodsData, strTitle, strIntro, returnNum, false));
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true);
     }
     return(false);
 }
Beispiel #2
0
 private bool SendMail(BuyBoCai2SDB buyItem, List <GoodsData> goodsData, string strTitle, string strIntro, int ItemNum, bool send = true)
 {
     try
     {
         string logTitle;
         if (buyItem.BocaiType == 2)
         {
             logTitle = "猜数字邮件";
         }
         else
         {
             logTitle = "猜大小邮件";
         }
         logTitle += (send ? "发奖" : "退回");
         if (Global.UseMailGivePlayerAward3(buyItem.m_RoleID, goodsData, strTitle, strIntro, 0, 0, 0))
         {
             GameManager.logDBCmdMgr.AddDBLogInfo(-1, "欢乐代币", string.Format("{0}成功", logTitle), "系统", buyItem.m_RoleName, "增加", ItemNum, buyItem.ZoneID, buyItem.strUserID, -1, buyItem.ServerId, null);
             return(true);
         }
         GameManager.logDBCmdMgr.AddMessageLog(-1, "欢乐代币", string.Format("{0}失败", logTitle), buyItem.m_RoleName, buyItem.m_RoleName, "增加", ItemNum, buyItem.ZoneID, buyItem.strUserID, -1, buyItem.ServerId, "");
         LogManager.WriteLog(LogTypes.Error, string.Format("[ljl_博彩]{2}失败 send email roleid={0}, num={1}, name={3}", new object[]
         {
             buyItem.m_RoleID,
             ItemNum,
             logTitle,
             buyItem.m_RoleName
         }), null, true);
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true);
     }
     return(false);
 }
Beispiel #3
0
 public void SoptServer()
 {
     try
     {
         lock (this.mutex)
         {
             this.dataList.AddRange(this.FailDataList);
             foreach (BoCaiBuy2DBData item in this.dataList)
             {
                 BuyBoCai2SDB DbData = item.data;
                 if (!"True".Equals(Global.Send2DB <BuyBoCai2SDB>(2082, DbData, 0)))
                 {
                     LogManager.WriteLog(LogTypes.Error, string.Format("[ljl_博彩购买队列]  服务器关闭... 发送失败 {0},{1},BocaiType={2},DataPeriods={3},BuyNum={4},BuyValue={5},“<0是发送状态”={6},win={7},send={8}", new object[]
                     {
                         DbData.m_RoleName,
                         DbData.m_RoleID,
                         DbData.BocaiType,
                         DbData.DataPeriods,
                         DbData.BuyNum,
                         DbData.strBuyValue,
                         item.itemNum,
                         DbData.IsWin,
                         DbData.IsSend
                     }), null, true);
                     GameManager.logDBCmdMgr.AddMessageLog(-1, "欢乐代币", "购买博彩DB通信失败扣物品成功", DbData.m_RoleName, DbData.m_RoleName, "减少", item.itemNum, DbData.ZoneID, DbData.strUserID, -1, DbData.ServerId, "");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩购买失败队列]{0}", ex.ToString()), null, true);
     }
 }
Beispiel #4
0
 public bool LoadBuyList(long DataPeriods)
 {
     try
     {
         if (!this.IsStart)
         {
             return(true);
         }
         List <BuyBoCai2SDB> ItemList = new List <BuyBoCai2SDB>();
         if (DataPeriods > 0L && !BoCaiManager.getInstance().GetBuyList2DB(this.BoCaiType, DataPeriods, out ItemList, 1))
         {
             LogManager.WriteLog(LogTypes.Error, string.Format("[ljl_caidaxiao_猜数字]获取购买记录失败 BoCaiType={0},DataPeriods={1}", this.BoCaiType, DataPeriods), null, true);
             return(false);
         }
         lock (this.mutex)
         {
             using (List <BuyBoCai2SDB> .Enumerator enumerator = ItemList.GetEnumerator())
             {
                 while (enumerator.MoveNext())
                 {
                     BuyBoCai2SDB       item        = enumerator.Current;
                     PlayerBuyBoCaiData playerBoCai = this.BoCaiBaseList.Find((PlayerBuyBoCaiData x) => x.RoleID == item.m_RoleID);
                     if (null == playerBoCai)
                     {
                         playerBoCai             = new PlayerBuyBoCaiData();
                         playerBoCai.BuyItemList = new List <BoCaiBuyItem>();
                         playerBoCai.ZoneID      = item.ZoneID;
                         playerBoCai.RoleID      = item.m_RoleID;
                         playerBoCai.ServerId    = item.ServerId;
                         playerBoCai.RoleName    = item.m_RoleName;
                         playerBoCai.strUserID   = item.strUserID;
                         this.BoCaiBaseList.Add(playerBoCai);
                     }
                     playerBoCai.BuyItemList.Add(new BoCaiBuyItem
                     {
                         BuyNum      = item.BuyNum,
                         strBuyValue = item.strBuyValue,
                         DataPeriods = item.DataPeriods
                     });
                 }
             }
             LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_caidaxiao_猜数字]加载购买数据true ,DataPeriods = {0}", DataPeriods), null, true);
             this.IsStart = false;
             return(true);
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_caidaxiao_猜数字]{0}", ex.ToString()), null, true);
     }
     LogManager.WriteLog(LogTypes.Error, "[ljl_caidaxiao_猜数字]猜数字获取排行 失败", null, true);
     return(false);
 }
Beispiel #5
0
 public void AddData(BuyBoCai2SDB DbData, int num, bool isAdd = true)
 {
     lock (this.mutex)
     {
         this.dataList.RemoveAll((BoCaiBuy2DBData x) => x.data.m_RoleID == DbData.m_RoleID && x.data.strBuyValue.Equals(DbData.strBuyValue) && x.data.DataPeriods == DbData.DataPeriods);
         this.FailDataList.RemoveAll((BoCaiBuy2DBData x) => x.data.m_RoleID == DbData.m_RoleID && x.data.strBuyValue.Equals(DbData.strBuyValue) && x.data.DataPeriods == DbData.DataPeriods);
         if (isAdd)
         {
             BoCaiBuy2DBData data = default(BoCaiBuy2DBData);
             data.data    = DbData;
             data.itemNum = num;
             this.dataList.Add(data);
         }
     }
 }
Beispiel #6
0
 public void BigTimeUpData()
 {
     try
     {
         List <BoCaiBuy2DBData> tempList = new List <BoCaiBuy2DBData>();
         lock (this.mutex)
         {
             if ((TimeUtil.NowDateTime() - this.upFailDataTime).TotalMinutes > 1.0)
             {
                 this.upFailDataTime = TimeUtil.NowDateTime();
                 tempList.AddRange(this.FailDataList);
                 this.FailDataList.Clear();
             }
             tempList.AddRange(this.dataList);
             this.dataList.Clear();
         }
         foreach (BoCaiBuy2DBData item in tempList)
         {
             BuyBoCai2SDB DbData = item.data;
             if (!"True".Equals(Global.Send2DB <BuyBoCai2SDB>(2082, DbData, 0)))
             {
                 LogManager.WriteLog(LogTypes.Warning, string.Format("[ljl_博彩购买队列] 发送失败 稍后会继续执行 {0},{1},BocaiType={2},DataPeriods={3},BuyNum={4},BuyValue={5},“<0是发送状态”={6},win={7},send={8}", new object[]
                 {
                     DbData.m_RoleName,
                     DbData.m_RoleID,
                     DbData.BocaiType,
                     DbData.DataPeriods,
                     DbData.BuyNum,
                     DbData.strBuyValue,
                     item.itemNum,
                     DbData.IsWin,
                     DbData.IsSend
                 }), null, true);
                 lock (this.mutex)
                 {
                     this.FailDataList.Add(item);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩购买失败队列]{0}", ex.ToString()), null, true);
     }
 }
Beispiel #7
0
 public bool SendWinItem(OpenLottery data, BuyBoCai2SDB buyItem)
 {
     try
     {
         buyItem.IsSend = true;
         string[] files = data.WinInfo.Split(new char[]
         {
             ','
         });
         List <int> winList;
         BoCaiHelper.String2ListInt(data.strWinNum, out winList);
         int        No1Win = Convert.ToInt32(files[0]);
         int        No2Win = Convert.ToInt32(files[1]);
         int        No3Win = Convert.ToInt32(files[2]);
         List <int> selfBuy;
         BoCaiHelper.String2ListInt(buyItem.strBuyValue, out selfBuy);
         if (selfBuy.Count != winList.Count)
         {
             LogManager.WriteLog(LogTypes.Error, string.Format("[ljl_博彩]selfBuy.Count != winList.Count DataPeriods={0}, type={1}, roleid={2}", data.DataPeriods, data.BocaiType, buyItem.m_RoleID), null, true);
             return(false);
         }
         int sameNum = 0;
         for (int i = 0; i < selfBuy.Count; i++)
         {
             if (selfBuy[i] == winList[i])
             {
                 sameNum++;
             }
         }
         int No     = 0;
         int WinNum = 0;
         if (sameNum == 5)
         {
             No     = 1;
             WinNum = No1Win * buyItem.BuyNum;
         }
         else if (sameNum == 4)
         {
             No     = 2;
             WinNum = No2Win * buyItem.BuyNum;
         }
         else if (sameNum == 3)
         {
             No     = 3;
             WinNum = No3Win * buyItem.BuyNum;
         }
         string strLog = string.Format("猜数字id={6},name={7}, {0}期开奖{1}赢得{2},自己购买{3},{4}注,info={5}", new object[]
         {
             data.DataPeriods,
             data.strWinNum,
             WinNum,
             buyItem.strBuyValue,
             buyItem.BuyNum,
             data.WinInfo,
             buyItem.m_RoleID,
             buyItem.m_RoleName
         });
         if (WinNum < 1)
         {
             buyItem.IsWin = false;
             BoCaiBuy2DBList.getInstance().AddData(buyItem, -1, true);
             return(true);
         }
         buyItem.IsWin = true;
         BoCaiBuy2DBList.getInstance().AddData(buyItem, -1, false);
         if (!"True".Equals(Global.Send2DB <BuyBoCai2SDB>(2082, buyItem, 0)))
         {
             LogManager.WriteLog(LogTypes.Warning, string.Format("[ljl_博彩]更新数据库标志失败,不发奖励,没关系 会自动处理旧数据{0}", strLog), null, true);
             return(false);
         }
         string           strTitle  = "猜数字";
         string           strIntro  = string.Format("恭喜您在{0}期猜数字玩法中,中{2}等奖,获得欢乐代币{1},系统将邮件的形式将您获取的欢乐代币返还与你。", buyItem.DataPeriods, WinNum, No);
         List <GoodsData> goodsData = new List <GoodsData>
         {
             HuanLeDaiBiManager.GetInstance().GetHuanLeDaiBi(WinNum)
         };
         return(this.SendMail(buyItem, goodsData, strTitle, strIntro, WinNum, true));
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true);
     }
     return(false);
 }
Beispiel #8
0
 public bool SendWinItem(OpenLottery data, BuyBoCai2SDB buyItem, double Rate, bool isSendMail, string winType)
 {
     try
     {
         buyItem.IsSend = true;
         if (!winType.Equals(buyItem.strBuyValue))
         {
             buyItem.IsWin = false;
             BoCaiBuy2DBList.getInstance().AddData(buyItem, -1, true);
             return(true);
         }
         int    WinNum   = (int)(Rate * (double)buyItem.BuyNum * (double)data.XiaoHaoDaiBi);
         string strTitle = "猜大小";
         string strIntro = string.Format("恭喜您在{0}期猜大小玩法中,获得欢乐代币{1},系统将邮件的形式将您获取的欢乐代币返还与你。", buyItem.DataPeriods, WinNum);
         buyItem.IsWin = true;
         string strLog = string.Format("TYPE= {8},id={6},name={7}, {0}期开奖{1}赢得{2},自己购买{3},{4}注,info={5}", new object[]
         {
             data.DataPeriods,
             data.strWinNum,
             WinNum,
             buyItem.strBuyValue,
             buyItem.BuyNum,
             data.WinInfo,
             buyItem.m_RoleID,
             buyItem.m_RoleName,
             buyItem.BocaiType
         });
         BoCaiBuy2DBList.getInstance().AddData(buyItem, -1, false);
         if (!"True".Equals(Global.Send2DB <BuyBoCai2SDB>(2082, buyItem, 0)))
         {
             LogManager.WriteLog(LogTypes.Warning, string.Format("[ljl_博彩]更新数据库标志失败,不发奖励,没关系 会自动处理旧数据{0}", strLog), null, true);
             return(WinNum < 1);
         }
         if (WinNum < 1)
         {
             return(true);
         }
         GoodsData        Goods     = HuanLeDaiBiManager.GetInstance().GetHuanLeDaiBi(WinNum);
         List <GoodsData> goodsData = new List <GoodsData>
         {
             Goods
         };
         if (isSendMail)
         {
             return(this.SendMail(buyItem, goodsData, strTitle, strIntro, WinNum, true));
         }
         GameClient client = GameManager.ClientMgr.FindClient(buyItem.m_RoleID);
         if (client != null && Global.CanAddGoods3(client, Goods.GoodsID, WinNum, Goods.Binding, "1900-01-01 12:00:00", true))
         {
             int ret = Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, Goods.GoodsID, Goods.GCount, Goods.Quality, Goods.Props, Goods.Forge_level, Goods.Binding, Goods.Site, Goods.Jewellist, true, 1, "猜大小中奖", "1900-01-01 12:00:00", 0, 0, 0, 0, 0, 0, 0, null, null, 0, true);
             LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_博彩]放在背包ret={1},{0}", strLog, ret), null, true);
             return(true);
         }
         return(this.SendMail(buyItem, goodsData, strTitle, strIntro, WinNum, true));
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true);
     }
     return(false);
 }
Beispiel #9
0
 private void BuyCaiDaXiao(GameClient client, int BuyNum, string strBuyVal, ref BuyBoCaiResult mgsData)
 {
     try
     {
         int value = Convert.ToInt32(strBuyVal);
         if (1 > value || value > 3 || BuyNum < 1)
         {
             mgsData.Info = 2;
             LogManager.WriteLog(LogTypes.Warning, string.Format("[ljl_博彩]BuyCaiDaXiao 购买内容 {0}, BuyNum={1} ", strBuyVal, BuyNum), null, true);
         }
         else if (!BoCaiCaiDaXiao.GetInstance().IsCanBuy())
         {
             mgsData.Info = 7;
         }
         else
         {
             ReturnValue <bool> msgData = TcpCall.KFBoCaiManager.IsCanBuy(1, strBuyVal, BuyNum + BoCaiCaiDaXiao.GetInstance().GetBuyNum(client.ClientData.RoleID), BoCaiCaiDaXiao.GetInstance().GetDataPeriods());
             if (!msgData.IsReturn)
             {
                 mgsData.Info = 8;
             }
             else if (!msgData.Value)
             {
                 mgsData.Info = 7;
             }
             else
             {
                 int useItemNum = BoCaiCaiDaXiao.GetInstance().GetXiaoHaoDaiBi() * BuyNum;
                 if (useItemNum < 1)
                 {
                     mgsData.Info = 3;
                     LogManager.WriteLog(LogTypes.Error, "[ljl_博彩]XiaoHaoDaiBi /GuDingLeiXing<1", null, true);
                 }
                 else if (!HuanLeDaiBiManager.GetInstance().HuanledaibiEnough(client, useItemNum))
                 {
                     mgsData.Info = 4;
                 }
                 else
                 {
                     int          allNum = BuyNum;
                     BuyBoCai2SDB DbData = BoCaiCaiDaXiao.GetInstance().BuyBocai(client, BuyNum, strBuyVal, ref allNum);
                     if (null == DbData)
                     {
                         mgsData.Info = 8;
                         BoCaiCaiDaXiao.GetInstance().BuyBocai(client, -BuyNum, strBuyVal, ref allNum);
                         LogManager.WriteLog(LogTypes.Error, "[ljl_博彩]BoCaiCaiDaXiao.GetInstance().BuyBocai err", null, true);
                     }
                     else if (!HuanLeDaiBiManager.GetInstance().UseHuanledaibi(client, useItemNum))
                     {
                         mgsData.Info = 4;
                     }
                     else
                     {
                         ReturnValue <bool> msgData2 = TcpCall.KFBoCaiManager.BuyBoCai(new KFBuyBocaiData
                         {
                             BocaiType = 1,
                             RoleID    = DbData.m_RoleID,
                             RoleName  = DbData.m_RoleName,
                             ZoneID    = DbData.ZoneID,
                             ServerID  = DbData.ServerId,
                             BuyNum    = DbData.BuyNum,
                             BuyValue  = DbData.strBuyValue
                         });
                         if (!msgData2.IsReturn)
                         {
                             mgsData.Info = 8;
                         }
                         else if (!msgData2.Value)
                         {
                             GameManager.logDBCmdMgr.AddMessageLog(-1, "欢乐代币", "购买失败扣物品成功中心2次通信", client.ClientData.RoleName, client.ClientData.RoleName, "减少", useItemNum, client.ClientData.ZoneID, client.strUserID, -1, client.ServerId, "");
                             mgsData.Info = 5;
                         }
                         else
                         {
                             DbData.BuyNum = allNum;
                             BoCaiBuy2DBList.getInstance().AddData(DbData, useItemNum, true);
                             BoCaiCaiDaXiao.GetInstance().CopyBuyList(out mgsData.ItemList, DbData.m_RoleID);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         mgsData.Info = 100;
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true);
     }
 }
Beispiel #10
0
 private void BuyCaiShuzi(GameClient client, int BuyNum, string strBuyVal, ref BuyBoCaiResult mgsData)
 {
     try
     {
         List <int> buyList;
         BoCaiHelper.String2ListInt(strBuyVal, out buyList);
         if (buyList.Count != 5 || BuyNum < 1)
         {
             mgsData.Info = 2;
             LogManager.WriteLog(LogTypes.Warning, string.Format("[ljl_博彩] BuyCaiShuzi 购买内容 {0}, BuyNum={1} ", strBuyVal, BuyNum), null, true);
         }
         else
         {
             for (int i = 0; i < buyList.Count; i++)
             {
                 if (buyList[i] > 9 || buyList[i] < 0)
                 {
                     mgsData.Info = 2;
                     return;
                 }
             }
             if (!BoCaiCaiShuZi.GetInstance().IsCanBuy())
             {
                 mgsData.Info = 7;
             }
             else
             {
                 ReturnValue <bool> msgData = TcpCall.KFBoCaiManager.IsCanBuy(2, strBuyVal, BuyNum, BoCaiCaiShuZi.GetInstance().GetDataPeriods());
                 if (!msgData.IsReturn)
                 {
                     mgsData.Info = 8;
                 }
                 else if (!msgData.Value)
                 {
                     mgsData.Info = 5;
                 }
                 else
                 {
                     int XiaoHaoDaiBi = BoCaiCaiShuZi.GetInstance().GetXiaoHaoDaiBi();
                     if (XiaoHaoDaiBi < 1)
                     {
                         mgsData.Info = 3;
                         LogManager.WriteLog(LogTypes.Error, "[ljl_博彩]XiaoHaoDaiBi /GuDingLeiXing<1", null, true);
                     }
                     else
                     {
                         int useItemNum = BuyNum * XiaoHaoDaiBi;
                         if (!HuanLeDaiBiManager.GetInstance().HuanledaibiEnough(client, useItemNum))
                         {
                             mgsData.Info = 4;
                         }
                         else
                         {
                             int          allNum = BuyNum;
                             BuyBoCai2SDB DbData = BoCaiCaiShuZi.GetInstance().BuyBocai(client, BuyNum, strBuyVal, ref allNum);
                             if (null == DbData)
                             {
                                 mgsData.Info = 8;
                                 BoCaiCaiShuZi.GetInstance().BuyBocai(client, -BuyNum, strBuyVal, ref allNum);
                                 LogManager.WriteLog(LogTypes.Error, "[ljl_博彩]BoCaiCaiShuZi.GetInstance().BuyBocai err", null, true);
                             }
                             else if (!HuanLeDaiBiManager.GetInstance().UseHuanledaibi(client, useItemNum))
                             {
                                 mgsData.Info = 4;
                             }
                             else
                             {
                                 ReturnValue <bool> msgData2 = TcpCall.KFBoCaiManager.BuyBoCai(new KFBuyBocaiData
                                 {
                                     BocaiType = 2,
                                     RoleID    = DbData.m_RoleID,
                                     RoleName  = DbData.m_RoleName,
                                     ZoneID    = DbData.ZoneID,
                                     ServerID  = DbData.ServerId,
                                     BuyNum    = DbData.BuyNum,
                                     BuyValue  = DbData.strBuyValue
                                 });
                                 if (!msgData2.IsReturn)
                                 {
                                     mgsData.Info = 8;
                                 }
                                 else if (!msgData2.Value)
                                 {
                                     GameManager.logDBCmdMgr.AddMessageLog(-1, "欢乐代币", "购买失败扣物品成功中心2次通信", client.ClientData.RoleName, client.ClientData.RoleName, "减少", useItemNum, client.ClientData.ZoneID, client.strUserID, -1, client.ServerId, "");
                                     mgsData.Info = 5;
                                 }
                                 else
                                 {
                                     DbData.BuyNum = allNum;
                                     BoCaiBuy2DBList.getInstance().AddData(DbData, useItemNum, true);
                                     BoCaiCaiShuZi.GetInstance().CopyBuyList(out mgsData.ItemList, DbData.m_RoleID);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         mgsData.Info = 100;
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_博彩]{0}", ex.ToString()), null, true);
     }
 }
Beispiel #11
0
        public BuyBoCai2SDB BuyBocai(GameClient client, int buyNum, string BuyVal, ref int allNum)
        {
            BuyBoCai2SDB DbData = null;

            try
            {
                lock (this.mutex)
                {
                    PlayerBuyBoCaiData playerBoCai = this.BoCaiBaseList.Find((PlayerBuyBoCaiData x) => x.RoleID == client.ClientData.RoleID);
                    if (null == playerBoCai)
                    {
                        playerBoCai             = new PlayerBuyBoCaiData();
                        playerBoCai.RoleID      = client.ClientData.RoleID;
                        playerBoCai.RoleName    = client.ClientData.RoleName;
                        playerBoCai.ZoneID      = client.ClientData.ZoneID;
                        playerBoCai.strUserID   = client.strUserID;
                        playerBoCai.ServerId    = client.ServerId;
                        playerBoCai.BuyItemList = new List <BoCaiBuyItem>();
                        BoCaiBuyItem item = new BoCaiBuyItem
                        {
                            BuyNum      = buyNum,
                            strBuyValue = BuyVal,
                            DataPeriods = this.ServerOpenData.DataPeriods
                        };
                        playerBoCai.BuyItemList.Add(item);
                        this.BoCaiBaseList.Add(playerBoCai);
                    }
                    else
                    {
                        BoCaiBuyItem item = playerBoCai.BuyItemList.Find((BoCaiBuyItem x) => x.strBuyValue.Equals(BuyVal));
                        if (null == item)
                        {
                            item = new BoCaiBuyItem
                            {
                                BuyNum      = buyNum,
                                strBuyValue = BuyVal,
                                DataPeriods = this.ServerOpenData.DataPeriods
                            };
                            playerBoCai.BuyItemList.Add(item);
                        }
                        else
                        {
                            item.BuyNum += buyNum;
                            allNum       = item.BuyNum;
                        }
                    }
                    DbData             = new BuyBoCai2SDB();
                    DbData.m_RoleID    = playerBoCai.RoleID;
                    DbData.m_RoleName  = playerBoCai.RoleName;
                    DbData.ZoneID      = playerBoCai.ZoneID;
                    DbData.strUserID   = playerBoCai.strUserID;
                    DbData.ServerId    = playerBoCai.ServerId;
                    DbData.BuyNum      = buyNum;
                    DbData.strBuyValue = BuyVal;
                    DbData.BocaiType   = this.BoCaiType;
                    DbData.DataPeriods = this.ServerOpenData.DataPeriods;
                    DbData.IsSend      = false;
                    DbData.IsWin       = false;
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_caidaxiao_猜数字]{0}", ex.ToString()), null, true);
            }
            return(DbData);
        }
Beispiel #12
0
 private void GetRank()
 {
     try
     {
         List <OpenLottery> openHistory = BoCaiManager.getInstance().GetNewOpenLottery10(this.BoCaiType);
         if (null != openHistory)
         {
             ReturnValue <List <KFBoCaoHistoryData> > msgData = TcpCall.KFBoCaiManager.GetWinHistory(this.BoCaiType);
             if (!msgData.IsReturn)
             {
                 LogManager.WriteLog(LogTypes.Error, "[ljl_caidaxiao_猜数字]猜数字获取排行 失败", null, true);
             }
             else
             {
                 List <KFBoCaoHistoryData> History = msgData.Value;
                 lock (this.mutex)
                 {
                     this.RankResult  = true;
                     this.OpenHistory = openHistory;
                     this.WinHistory.Clear();
                     if (null != History)
                     {
                         using (List <KFBoCaoHistoryData> .Enumerator enumerator = History.GetEnumerator())
                         {
                             while (enumerator.MoveNext())
                             {
                                 KFBoCaoHistoryData item = enumerator.Current;
                                 OpenLottery        data = this.OpenHistory.Find((OpenLottery x) => x.DataPeriods == item.DataPeriods);
                                 if (data != null && !string.IsNullOrEmpty(data.strWinNum))
                                 {
                                     item.OpenData = data.strWinNum;
                                     this.WinHistory.Add(item);
                                 }
                             }
                         }
                         List <long> DataPeriodsList  = new List <long>();
                         List <long> DataPeriodsList2 = new List <long>();
                         foreach (OpenLottery open in this.OpenHistory)
                         {
                             DataPeriodsList.Add(open.DataPeriods);
                         }
                         DataPeriodsList2 = this.BuyItemHistoryDict.Keys.ToList <long>();
                         using (List <long> .Enumerator enumerator3 = DataPeriodsList2.GetEnumerator())
                         {
                             while (enumerator3.MoveNext())
                             {
                                 long Periods = enumerator3.Current;
                                 if (DataPeriodsList.Find((long x) => x == Periods) < 1L)
                                 {
                                     this.BuyItemHistoryDict.Remove(Periods);
                                 }
                             }
                         }
                         foreach (long Periods2 in DataPeriodsList)
                         {
                             if (!this.BuyItemHistoryDict.ContainsKey(Periods2))
                             {
                                 List <BuyBoCai2SDB> ItemList;
                                 if (BoCaiManager.getInstance().GetBuyList2DB(this.BoCaiType, Periods2, out ItemList, 1))
                                 {
                                     List <RoleBuyHistory> roleBuyList = new List <RoleBuyHistory>();
                                     using (List <BuyBoCai2SDB> .Enumerator enumerator4 = ItemList.GetEnumerator())
                                     {
                                         while (enumerator4.MoveNext())
                                         {
                                             BuyBoCai2SDB   dbdata   = enumerator4.Current;
                                             RoleBuyHistory roledata = roleBuyList.Find((RoleBuyHistory x) => x.RoleID == dbdata.m_RoleID);
                                             if (null == roledata)
                                             {
                                                 roledata             = new RoleBuyHistory();
                                                 roledata.RoleID      = dbdata.m_RoleID;
                                                 roledata.BuyItemList = new List <BoCaiBuyItem>();
                                                 roleBuyList.Add(roledata);
                                             }
                                             roledata.BuyItemList.Add(new BoCaiBuyItem
                                             {
                                                 BuyNum      = dbdata.BuyNum,
                                                 strBuyValue = dbdata.strBuyValue,
                                                 DataPeriods = Periods2
                                             });
                                         }
                                     }
                                     this.BuyItemHistoryDict.Add(Periods2, roleBuyList);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_caidaxiao_猜数字]{0}", ex.ToString()), null, true);
     }
 }
Beispiel #13
0
 private void OpenLotterySetWin()
 {
     try
     {
         if (this.StageData.Stage == 5 && !this.ServerData.IsAward)
         {
             if (string.IsNullOrEmpty(this.ServerOpenData.strWinNum) || string.IsNullOrEmpty(this.ServerOpenData.WinInfo))
             {
                 this.GetOpenLotteryData(false);
             }
             if (this.FirstDataPeriods == this.ServerOpenData.DataPeriods && this.FirstDataPeriods > 0L)
             {
                 if (null != this.StartServerOpenData)
                 {
                     if (this.StartServerOpenData.DataPeriods == this.FirstDataPeriods && this.StartServerOpenData.IsAward)
                     {
                         return;
                     }
                 }
                 else if (this.StartServerStage > BoCaiStageEnum.Stage_Open)
                 {
                     return;
                 }
             }
             if (this.ServerOpenData.DataPeriods >= 1L && this.ServerOpenData.XiaoHaoDaiBi >= 1 && !string.IsNullOrEmpty(this.ServerOpenData.strWinNum) && !string.IsNullOrEmpty(this.ServerOpenData.WinInfo))
             {
                 LogManager.WriteLog(LogTypes.Info, string.Format("[ljl_caidaxiao_猜数字]猜数字 开奖 GetOpenLottery su DataPeriods={0}", this.ServerOpenData.DataPeriods), null, true);
                 List <BuyBoCai2SDB> BuyList = new List <BuyBoCai2SDB>();
                 lock (this.mutex)
                 {
                     foreach (PlayerBuyBoCaiData PlayerBuyData in this.BoCaiBaseList)
                     {
                         BuyBoCai2SDB buyItem = new BuyBoCai2SDB
                         {
                             ZoneID      = PlayerBuyData.ZoneID,
                             m_RoleID    = PlayerBuyData.RoleID,
                             ServerId    = PlayerBuyData.ServerId,
                             strUserID   = PlayerBuyData.strUserID,
                             m_RoleName  = PlayerBuyData.RoleName,
                             DataPeriods = this.ServerOpenData.DataPeriods,
                             BocaiType   = this.BoCaiType,
                             IsSend      = false,
                             IsWin       = false
                         };
                         foreach (BoCaiBuyItem item in PlayerBuyData.BuyItemList)
                         {
                             if (item.DataPeriods == this.ServerOpenData.DataPeriods)
                             {
                                 BuyBoCai2SDB temp = new BuyBoCai2SDB();
                                 GlobalNew.Copy <BuyBoCai2SDB>(buyItem, ref temp);
                                 temp.BuyNum      = item.BuyNum;
                                 temp.strBuyValue = item.strBuyValue;
                                 BuyList.Add(temp);
                             }
                         }
                     }
                 }
                 this.ServerOpenData.IsAward = true;
                 this.ServerData.IsAward     = true;
                 foreach (BuyBoCai2SDB buyItem in BuyList)
                 {
                     if (!BoCaiManager.getInstance().SendWinItem(this.ServerOpenData, buyItem))
                     {
                         this.ServerOpenData.IsAward = false;
                     }
                 }
                 if (this.ServerOpenData.IsAward)
                 {
                     Global.Send2DB <OpenLottery>(2084, this.ServerOpenData, 0);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl_caidaxiao_猜数字]{0}", ex.ToString()), null, true);
     }
 }