public List <ConfigMallgiftbagEntity> GetGiftBag(int mallId) { var list = ConfigMallgiftbagMgr.GetAll(); if (list.Count == 0) { return(new List <ConfigMallgiftbagEntity>()); } return(list.FindAll(r => r.MallCode == mallId)); }
void InitCache() { LogHelper.Insert("Mall cache init start", LogType.Info); _coachDebristDic = new Dictionary <int, DicMallitemEntity>(); var list = DicMallitemMgr.GetAllForCache(); _mallItemDic = new Dictionary <int, DicMallItemDataEntity>(list.Count); _showList = new List <DicMallItemDataEntity>(); _theContractdic = new Dictionary <int, int>(); _mallTypeDic = new Dictionary <int, List <DicMallitemEntity> >(); foreach (var entity in list) { var newEntity = new DicMallItemDataEntity(); newEntity.RawCurrencyCount = entity.CurrencyCount; newEntity.EffectType = entity.EffectType; newEntity.EffectValue = entity.EffectValue; newEntity.UseLevel = entity.UseLevel; newEntity.CurrencyType = entity.CurrencyType; newEntity.HotFlag = entity.HotFlag; newEntity.ImageId = entity.ImageId; newEntity.MallCode = entity.MallCode; newEntity.MallType = entity.MallType; newEntity.CurrencyCount = entity.CurrencyCount; newEntity.PointInTimes = CalDiscount(entity); newEntity.ShowFlag = entity.ShowFlag; newEntity.ShowOrder = entity.ShowOrder; newEntity.PackageFlag = entity.PackageFlag; newEntity.Description = entity.ItemIntro; newEntity.Name = entity.Name; newEntity.Quality = entity.Quality; newEntity.ShowBatch = entity.ShowBatch; newEntity.CurrencyDiscount = entity.CurrencyDiscount; _mallItemDic.Add(entity.MallCode, newEntity); if (entity.ShowFlag) { _showList.Add(newEntity); } if (!_mallTypeDic.ContainsKey(entity.MallType)) { _mallTypeDic.Add(entity.MallType, new List <DicMallitemEntity>()); } _mallTypeDic[entity.MallType].Add(entity); if (entity.EffectType == (int)EnumMallEffectType.CoachDebris) { if (!_coachDebristDic.ContainsKey(entity.MallCode)) { _coachDebristDic.Add(entity.MallCode, entity); } } } var list2 = ConfigMallextraMgr.GetAll(); _mallExtraLinkDic = new Dictionary <int, Dictionary <int, int> >(); foreach (var entity in list2) { if (!_mallExtraLinkDic.ContainsKey(entity.ExtraType)) { _mallExtraLinkDic.Add(entity.ExtraType, new Dictionary <int, int>()); } _mallExtraLinkDic[entity.ExtraType].Add(entity.UsedCount, entity.MallCode); } var list3 = DicNewplayerpackMgr.GetAllForCache(); _newplayerpackDic = new Dictionary <int, List <DicNewplayerpackEntity> >(); foreach (var entity in list3) { if (!_newplayerpackDic.ContainsKey(entity.PackId)) { _newplayerpackDic.Add(entity.PackId, new List <DicNewplayerpackEntity>()); } _newplayerpackDic[entity.PackId].Add(entity); } var list4 = ConfigMalldirectMgr.GetAll(); _mallDirectDic = new Dictionary <int, Dictionary <int, ConfigMalldirectEntity> >(); foreach (var entity in list4) { if (!_mallDirectDic.ContainsKey(entity.ConsumeSourceType)) { _mallDirectDic.Add(entity.ConsumeSourceType, new Dictionary <int, ConfigMalldirectEntity>()); } _mallDirectDic[entity.ConsumeSourceType].Add(entity.UsedCount, entity); } _theContractdic = list.FindAll(r => r.EffectType == (int)EnumMallEffectType.TheContract).ToDictionary(r => r.EffectValue, r => r.MallCode); //绑定商城 价格为原商城的2倍 _bindShowList = new List <DicMallItemDataEntity>(); foreach (var entity in _showList) { if (entity.MallType != 6 && entity.MallType != 7 && entity.EffectType != 9) { var newEntity = entity.Clone(); newEntity.CurrencyType = (int)EnumCurrencyType.BindPoint; newEntity.CurrencyCount *= 2; newEntity.RawCurrencyCount *= 2; _bindShowList.Add(newEntity); } } _giftBagDic = new Dictionary <int, List <ConfigMallgiftbagEntity> >(); var allgiftPrize = ConfigMallgiftbagMgr.GetAll(); foreach (var item in allgiftPrize) { if (!_giftBagDic.ContainsKey(item.MallCode)) { _giftBagDic.Add(item.MallCode, new List <ConfigMallgiftbagEntity>()); } _giftBagDic[item.MallCode].Add(item); } _txChargeIdDic = new Dictionary <int, ConfigTxchargeidEntity>(); var alltxId = ConfigTxchargeidMgr.GetAll(); foreach (var item in alltxId) { var key = Getkey(item.MallCode, item.ZoneType); if (!_txChargeIdDic.ContainsKey(key)) { _txChargeIdDic.Add(key, item); } } LogHelper.Insert("Mall cache init end", LogType.Info); }