private bool SetOutTimeItem(GoldAuctionItem AuctionItem) { try { if (AuctionItem.Lock || DateTime.Parse(AuctionItem.AuctionTime).AddHours((double)AuctionItem.LifeTime) > TimeUtil.NowDateTime()) { return(true); } if (AuctionItem.BuyerData.m_RoleID != 0) { return(this.DisposeAward(AuctionItem)); } AuctionConfig AuctionCfg = GoldAuctionConfigModel.GetAuctionConfig(AuctionItem.AuctionSource); if (null == AuctionCfg) { LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]null == config AuctionSource = {0}", AuctionItem.AuctionSource), null, true); return(false); } int NextAuctiontype = AuctionCfg.GetNextAuction(AuctionItem.AuctionType); if (NextAuctiontype <= -1) { return(this.DisposeAward(AuctionItem)); } AuctionItem.OldAuctionType = AuctionItem.AuctionType; AuctionItem.AuctionType = NextAuctiontype; AuctionItem.AuctionTime = TimeUtil.NowDataTimeString("yyyy-MM-dd HH:mm:ss"); AuctionItem.UpDBWay = 3; AuctionItem.LifeTime = AuctionCfg.GetTimeByAuction(NextAuctiontype); this.S2CCache.Clear(); if (this.SendUpdate2DB(AuctionItem)) { LogManager.WriteLog(LogTypes.Info, string.Format("[ljl]超时换拍卖行ProductionTime = {0}, AuctionSource={1},AuctionType={2}", AuctionItem.ProductionTime, AuctionItem.AuctionSource, AuctionItem.AuctionType), null, true); return(true); } LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]超时换拍卖行 db失败 ProductionTime = {0}, AuctionSource={1}", AuctionItem.ProductionTime, AuctionItem.AuctionSource), null, true); if (AuctionItem.LifeTime == -1) { LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]GetTimeByAuction =-1 AuctionOrderEnum={0}", NextAuctiontype), null, true); } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true); } return(false); }
private void InitFromDB() { try { for (int i = 1; i < 3; i++) { LogManager.WriteLog(LogTypes.Info, string.Format("[ljl]InitFromDB AuctionID={0}", i), null, true); GetAuctionDBData DBData = Global.sendToDB <GetAuctionDBData, string>(2080, i.ToString(), 0); if (DBData == null || !DBData.Flag) { LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]GoldAuctionManager.InitFromDB DBData={0}, type={1}", null == DBData, i), null, true); } else { foreach (GoldAuctionDBItem item in DBData.ItemList) { GoldAuctionItem temp = new GoldAuctionItem(); CopyData.CopyAuctionDB2Item(item, out temp); AuctionConfig AuctionCfg = GoldAuctionConfigModel.GetAuctionConfig(item.AuctionSource); if (null == AuctionCfg) { LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]GetAuctionConfig null == config AuctionSource ={0}", ((AuctionEnum)item.AuctionSource).ToString()), null, true); } else { temp.LifeTime = AuctionCfg.GetTimeByAuction(i); if (temp.LifeTime == -1) { LogManager.WriteLog(LogTypes.Error, string.Format("[ljl]GetTimeByAuction =-1 AuctionOrderEnum={0}", i), null, true); } else { this.AddNewAuctionItem(temp); } } } } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Exception, string.Format("[ljl]{0}", ex.ToString()), null, true); } }