public string TxBuyPointShipments(Guid managerId, string orderId, int mallCode, string zoneId) { try { var manager = NbManagerMgr.GetById(managerId, zoneId); if (manager == null) { return("找不到经理信息"); } var mallConfig = DicMallitemMgr.GetById(mallCode); //var mallConfig = CacheFactory.MallCache.GetMallEntityWithoutPoint(mallCode); if (mallConfig == null || (mallConfig.MallType != (int)EnumMallType.QP && mallConfig.MallType != (int)EnumMallType.Mystery)) { return("请输入正确的商城ID"); } ManagerMonthcardEntity monthcardEntity = null; DateTime date = DateTime.Now; int bonus = 0; var recordList = ManagerChargenumberMgr.GetManagerIdList(managerId, zoneId); ManagerChargenumberEntity buyRecord = null; bool isFirst = false; if (recordList.Count > 0) { buyRecord = recordList.Find(r => r.MallCode == mallCode); } else { isFirst = true; } if (buyRecord == null) { buyRecord = new ManagerChargenumberEntity(0, managerId, mallCode, 1, date, date); } else { buyRecord.BuyNumber++; } MailBuilder mail = null; List <ConfigMallgiftbagEntity> prizeList = null; EnumMailType mailType = EnumMailType.ChargeSuccess; int point = mallConfig.CurrencyCount; if (mallConfig.EffectType == (int)EnumMallEffectType.MonthCard) //月卡 { MonthcardShipments(managerId, ref monthcardEntity, zoneId); } else if (mallConfig.MallType == (int)EnumMallType.Mystery) { if (mallConfig.EffectType == (int)EnumMallEffectType.GiftBag) { //if (!IsHaveBuyWeekGiftBag(buyRecord, DateTime.Now)) //{ // mailType = EnumMailType.ChargeSuccess; // point = mallConfig.EffectValue * 10; //} //else //{ prizeList = GetGiftBag(mallCode); if (prizeList.Count <= 0) { return("获取配置失败"); } mailType = EnumMailType.GiftBagSuccess; //} } else if (mallConfig.EffectType == (int)EnumMallEffectType.WeeklyGiftBag) { //if (!IsHaveBuyWeekGiftBag(buyRecord)) //{ // mailType = EnumMailType.ChargeSuccess; // point = mallConfig.EffectValue * 10; //} //else //{ prizeList = GetGiftBag(mallCode); if (prizeList.Count <= 0) { return("获取配置失败"); } mailType = EnumMailType.GiftBagSuccess; //} } //else if (buyRecord.Idx > 0) //{ // mailType = EnumMailType.ChargeSuccess; // point = mallConfig.EffectValue * 10; //} else { prizeList = GetGiftBag(mallCode); if (prizeList.Count <= 0) { return("获取配置失败"); } mailType = EnumMailType.GiftBagSuccess; } } prizeList = GetGiftBag(mallCode); var payEntity = new PayChargehistoryEntity(); payEntity.Idx = orderId; payEntity.Account = _account.Account; payEntity.BillingId = orderId; payEntity.Bonus = bonus; payEntity.Cash = 0; payEntity.IsFirst = isFirst; payEntity.MallCode = mallCode; payEntity.Point = point; payEntity.RowTime = DateTime.Now; payEntity.SourceType = (int)EnumChargeSourceType.GmCharge; payEntity.States = 2; payEntity.UpdateTime = DateTime.Now; //邮件发货 mail = new MailBuilder(managerId, mallConfig.Name, point + bonus, prizeList, mailType, 0, 0); buyRecord.UpdateTiem = DateTime.Now; payEntity.Bonus = bonus; var code = SaveBuyPointShipmentsTx(manager, point, bonus, payEntity, monthcardEntity, mail, buyRecord, mallConfig, zoneId); return(code); } catch (Exception ex) { SystemlogMgr.Error("充值发货", ex); return(ex.Message); } }
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); }
public static ItemTipsEntity ExportItemTips() { var itemList = DicItemMgr.GetAll(); var playerList = DicPlayerMgr.GetAll(); var equipmentList = DicEquipmentMgr.GetAll(); var mallList = DicMallitemMgr.GetAll().FindAll(d => d.MallType != 5); var ballList = DicBallsoulMgr.GetAll(); var willList = DicManagerwillMgr.GetAll(); var starskillList = DicStarskillsMgr.GetAll(); ItemTipsEntity itemTips = new ItemTipsEntity(); itemTips.PlayerCard = new List <PlayerCardDescriptionEntity>(playerList.Count); itemTips.Equipment = new List <EquipmentDescriptionEntity>(equipmentList.Count); itemTips.Ballsoul = new List <BallsoulDescriptionEntity>(0); itemTips.MallItem = new List <MallItemDescriptionEntity>(mallList.Count); foreach (var itemEntity in itemList) { switch (itemEntity.ItemType) { case (int)EnumItemType.PlayerCard: var playerd = BuildPlayerCardDescription(itemEntity, playerList.Find(d => d.Idx == itemEntity.LinkId)); var star = starskillList.FindAll(d => d.PlayerId == playerd.PlayerId); if (star.Count > 0) { playerd.Starskill = ""; playerd.StarskillCode = ""; foreach (var entity in star) { playerd.Starskill += entity.Name + ","; playerd.StarskillCode += entity.SkillCode + ","; } playerd.Starskill = playerd.Starskill.TrimEnd(','); playerd.StarskillCode = playerd.StarskillCode.TrimEnd(','); } var wills = willList.FindAll(d => d.DriveFlag == 1 && d.PartMap.Contains(playerd.PlayerId.ToString())); if (wills != null && wills.Count > 0) { foreach (var entity in wills) { playerd.CombSkill = entity.SkillName + ","; } playerd.CombSkill = playerd.CombSkill.TrimEnd(','); } itemTips.PlayerCard.Add(playerd); break; case (int)EnumItemType.Equipment: var equipd = BuildEquipmentDescription(itemEntity, equipmentList.Find(d => d.Idx == itemEntity.LinkId)); itemTips.Equipment.Add(equipd); break; case (int)EnumItemType.MallItem: var malld = BuildMallDescription(itemEntity, mallList.Find(d => d.MallCode == itemEntity.LinkId)); itemTips.MallItem.Add(malld); break; } } return(itemTips); }