Пример #1
0
 public void LoadDataFromDB(DBManager DBMgr)
 {
     try
     {
         lock (this.AuctionMsgMutex)
         {
             GoldAuctionDB.DelData(string.Format("UpDBWay='Del' AND UpdateTime < '{0}'", DateTime.Now.AddDays(-365.0).ToString("yyyy-MM-dd HH:mm:ss")));
             this.AuctionDict.Clear();
             for (int i = 1; i < 3; i++)
             {
                 List <GoldAuctionDBItem> dList;
                 if (GoldAuctionDB.Select(out dList, i))
                 {
                     this.AuctionDict.Add(i, dList);
                     LjlLog.WriteLog(LogTypes.Info, string.Format("初始化金团数据type={0},len={1}", ((AuctionOrderEnum)i).ToString(), dList.Count), "");
                 }
                 else
                 {
                     LjlLog.WriteLog(LogTypes.Info, string.Format("初始化金团数据type={0},false", ((AuctionOrderEnum)i).ToString()), "");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true);
     }
 }
Пример #2
0
        private void GetGlodAuction(GameServerClient client, int nID, byte[] cmdParams, int count)
        {
            GetAuctionDBData msgData = new GetAuctionDBData();

            try
            {
                string cmdData = new UTF8Encoding().GetString(cmdParams, 0, count);
                int    type    = Convert.ToInt32(cmdData);
                List <GoldAuctionDBItem> tempList;
                if (3 <= type || 0 >= type)
                {
                    msgData.Flag = false;
                    LjlLog.WriteLog(LogTypes.Error, string.Format("GetGlodAuction 金团类型错误{0} type=", type), "");
                }
                else if (this.AuctionDict.TryGetValue(type, out tempList))
                {
                    msgData.Flag = CopyData.CopyAuctionDBItem(tempList, ref msgData.ItemList);
                }
                else
                {
                    msgData.Flag = GoldAuctionDB.Select(out msgData.ItemList, type);
                    if (msgData.Flag)
                    {
                        tempList = new List <GoldAuctionDBItem>();
                        if (CopyData.CopyAuctionDBItem(msgData.ItemList, ref tempList))
                        {
                            this.AuctionDict.Add(type, tempList);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LjlLog.WriteLog(LogTypes.Exception, ex.ToString(), "");
            }
            client.sendCmd <GetAuctionDBData>(nID, msgData);
        }