void BindData() { var accountData = Master.GetAccount(); if (accountData == null) { Master.ShowMessage("请先选择经理."); return; } ClearData(); var manager = NbManagerMgr.GetById(accountData.ManagerId, accountData.ZoneId); if (manager == null) { Master.ShowMessage("获取经理信息失败."); return; } lblPoint.Text = manager.Coin.ToString(); int chargeCoin = 0; int consumeCoin = 0; ShadowMgr.CoinStat(accountData.ManagerId, ref chargeCoin, ref consumeCoin, accountData.ZoneId); lblCharge.Text = chargeCoin.ToString(); lblConsume.Text = consumeCoin.ToString(); lblPoint2.Text = string.Format("{0}", chargeCoin - consumeCoin); }
public CrossladderManagerResponse GetLadderManager(string siteId, Guid managerId) { try { var ladderManager = CrossladderManagerMgr.GetById(managerId); if (ladderManager == null) { if (!ManagerUtil.CheckFunction(siteId, managerId, EnumOpenFunction.CrossLadder)) { return(ResponseHelper.Create <CrossladderManagerResponse>(MessageCode.NbFunctionNotOpen)); } var nbManager = NbManagerMgr.GetById(managerId, siteId); if (nbManager == null) { return(ResponseHelper.Create <CrossladderManagerResponse>(MessageCode.MissManager)); } int domainId = 0; int honor = 0; CrossladderManagerMgr.GetOldHonor(managerId, ref honor); CrossSiteCache.Instance().TryGetDomainId(siteId, out domainId); ladderManager = new CrossladderManagerEntity(); ladderManager.DomainId = domainId; ladderManager.SiteId = siteId; ladderManager.SiteName = CacheFactory.FunctionAppCache.GetCrossZoneName(siteId); ladderManager.ManagerId = managerId; ladderManager.Name = nbManager.Name; ladderManager.SiteId = siteId; ladderManager.Logo = nbManager.Logo; ladderManager.Score = _ladderRegisterScore; ladderManager.LastExchageTime = ShareUtil.BaseTime; ladderManager.RowTime = DateTime.Now; ladderManager.UpdateTime = DateTime.Now; ladderManager.Honor = honor; ladderManager.MaxScore = _ladderRegisterScore; ladderManager.DailyMaxScore = _ladderRegisterScore; ladderManager.Stamina = 50; CrossladderManagerMgr.Insert(ladderManager); } if (ladderManager.Stamina < 0) { ladderManager.Stamina = 0; } if (ladderManager.StaminaBuy < 0) { ladderManager.StaminaBuy = 0; } var response = ResponseHelper.CreateSuccess <CrossladderManagerResponse>(); response.Data = ladderManager; return(response); } catch (Exception ex) { SystemlogMgr.Error("GetCrossLadderManager", ex); return(ResponseHelper.Create <CrossladderManagerResponse>(MessageCode.Exception)); } }
public bool IsTxVip(Guid managerId) { var manager = NbManagerMgr.GetById(managerId); if (manager == null) { return(false); } return(IsTxVip(manager)); }
/// <summary> /// 获取分享信息 /// </summary> /// <param name="managerId"></param> /// <param name="shareType">分享类型 4=关注</param> /// <returns></returns> public ShareGetResponse GetShareInfo(Guid managerId, int shareType) { var response = new ShareGetResponse(); response.Data = new ShareGet(); try { var manager = NbManagerMgr.GetById(managerId); if (manager == null) { return(ResponseHelper.Create <ShareGetResponse>(MessageCode.MissManager)); } var config = CacheFactory.ManagerDataCache.GetShare(shareType); if (config == null || config.Count == 0) { return(ResponseHelper.Create <ShareGetResponse>(MessageCode.ActivityNoConfigPrize)); } var record = ShareManagerMgr.GetByManagerId(managerId, shareType); if (record != null) { DateTime date = DateTime.Now; if (record.UpdateTime.Date != date.Date) { var code = RefreshRecord(record, config[0]); if (code != MessageCode.Success) { return(ResponseHelper.Create <ShareGetResponse>(code)); } } if (shareType == 1)//第一种特殊处理 { if (record.ShareNumber > 0) { int seconds = 3600 - (date - record.UpdateTime).Seconds; response.Data.NextShareEnd = seconds < 0 ? 0 : seconds; } } response.Data.IsFirstShare = false; response.Data.ShareNumber = record.ShareNumber; response.Data.IsHaveShare = config[0].MaxShareNumber > record.ShareNumber; } else { response.Data.IsHaveShare = true; response.Data.IsFirstShare = true; response.Data.ShareNumber = 0; } } catch (Exception ex) { SystemlogMgr.Error("获取分享信息", ex); response.Code = (int)MessageCode.NbParameterError; } return(response); }
/// <summary> /// 是否开启了拍卖行 /// </summary> /// <param name="managerId"></param> /// <param name="zoneName"></param> /// <param name="manager"></param> /// <returns></returns> public bool IsOpen(Guid managerId, string zoneName, NbManagerEntity manager = null) { if (manager == null) { manager = NbManagerMgr.GetById(managerId, zoneName); } if (manager == null) { return(false); } if (manager.Level < 30 && manager.VipLevel < 3) { return(false); } return(true); }
private bool GetManagerByIdx(string zoneId) { var idx = txtManagerId.Text.Trim(); Guid managerId = Guid.Empty; Guid.TryParse(idx, out managerId); if (managerId != Guid.Empty) { var manager = NbManagerMgr.GetById(managerId, zoneId); if (manager != null) { SetAccount(manager, zoneId); return(true); } } return(false); }
public CrossMallDirectFrame(string siteId, Guid managerId, EnumConsumeSourceType consumeSourceType, int usedCount = 0) { _siteId = siteId; var manager = NbManagerMgr.GetById(managerId, siteId); if (manager != null) { _managerId = managerId; _account = manager.Account; _configMalldirectEntity = CacheFactory.MallCache.GetDirectEntity(consumeSourceType, usedCount); if (_configMalldirectEntity == null) { string msg = "can't find mall direct config,consumeSourceType:" + consumeSourceType + ",usedCount:" + usedCount; LogHelper.Insert(msg, LogType.Info); throw new Exception(msg); } } }
public static long GetWorthValue(Guid managerId, WorthSource worthSrc, EnumWorthType worthType) { long val = -1; try { if (null == worthSrc) { worthSrc = new WorthSource(); } if (null == worthSrc.Manager) { worthSrc.Manager = NbManagerMgr.GetById(managerId); } if (null == worthSrc.Manager) { return(val); } switch (worthType) { case EnumWorthType.Gold: if (null == worthSrc.Account) { worthSrc.Account = GetPayAccount(worthSrc.Manager.Account); } return(worthSrc.Account.TotalPoint); case EnumWorthType.Coin: return(worthSrc.Manager.Coin); case EnumWorthType.ManagerLevel: return(worthSrc.Manager.Level); case EnumWorthType.VipLevel: return(worthSrc.Manager.VipLevel); } } catch (Exception ex) { SystemlogMgr.Error("FrameConvert:GetWorthValue", ex); } return(val); }
public static NbManagerEntity GetManager(Guid managerId, bool containKpi = false, bool containTourLeague = false, string siteId = "") { try { var manager = MemcachedFactory.ManagerClient.Get <NbManagerEntity>(managerId); if (manager == null) { manager = NbManagerMgr.GetById(managerId, siteId); if (manager != null) { if (containTourLeague) { FillTourLeague(manager); } //if (!string.IsNullOrEmpty(siteId)) //{ //manager.Name = ShareUtil.GetCrossManagerNameByZoneId(siteId, manager.Name); //} MemcachedFactory.ManagerClient.Set(manager.Idx, manager); } } if (manager != null) { if (containKpi) { manager.Kpi = GetManagerKpi(managerId, siteId); } if (containTourLeague && manager.TourLeague <= 0) { FillTourLeague(manager); MemcachedFactory.ManagerClient.Set(manager.Idx, manager); } } return(manager); } catch (Exception ex) { SystemlogMgr.Error("GetManager", "get manager data fail,mid:" + managerId, ex.StackTrace); throw ex; } }
public static WorthSource GetWorthSource(Guid managerId, bool managerFlag, bool accountFlag, string siteId = "") { var obj = new WorthSource(); try { if (managerFlag || accountFlag) { obj.Manager = NbManagerMgr.GetById(managerId, siteId); } if (accountFlag) { obj.Account = GetPayAccount(obj.Manager.Account, siteId); } } catch (Exception ex) { SystemlogMgr.Error("FrameConvert:GetWorthSource", ex); } return(obj); }
protected void btnUpLevel_Click(object sender, EventArgs e) { try { if (CheckManager()) { var level = ConvertHelper.ConvertToInt(txtLevel.Text); if (level < 1) { ShowMessage("等级不能小于1"); return; } if (level > 80) { ShowMessage("等级不能超过80"); return; } var exp = ConvertHelper.ConvertToInt(txtExp.Text); var manager = NbManagerMgr.GetById(_account.ManagerId, _account.ZoneId); manager.Level = level; manager.EXP = exp; if (NbManagerMgr.Update(manager, null, _account.ZoneId)) { SaveAdminLog(EnumAdminOperationType.UpLevel, string.Format("Level:{0}", level)); ShowMessage("修改等级成功"); } else { ShowMessage("修改等级失败"); } } } catch (Exception ex) { LogHelper.Insert(ex); ShowMessage(ex.Message); } }
/// <summary> /// 获取活动信息 /// </summary> /// <param name="managerId"></param> /// <param name="zoneName"></param> /// <returns></returns> public CrossActivityInfoResponse GetActivityInfo(Guid managerId, string zoneName) { CrossActivityInfoResponse response = new CrossActivityInfoResponse(); response.Data = new CrossActivityInfo(); try { if (!IsActivity) { response.Data.IsOpen = false; return(response); } var managerInfo = NbManagerMgr.GetById(managerId, zoneName); if (managerInfo == null) { return(ResponseHelper.Create <CrossActivityInfoResponse>(MessageCode.NbParameterError)); } var maxCount = CacheFactory.VipdicCache.GetEffectValue(managerInfo.VipLevel, (int)EnumVipEffect.BeThankfulActivity); var usedNumber = CrossactivityRecordMgr.GetActivityNumber(managerId, DateTime.Now.Date); response.Data.MaxNumber = maxCount; response.Data.UsedNumber = usedNumber; response.Data.GoldBar = _ActivityInfo.GoldBarNumber; //response.Data.PrizeList = CacheFactory.TurntableCache.GetAllPrize(); response.Data.IsOpen = true; response.Data.ActivityEnd = ShareUtil.GetTimeTick(_ActivityInfo.EndTime); response.Data.ActivityStart = ShareUtil.GetTimeTick(_ActivityInfo.StartTime); response.Data.IsPrompt = maxCount > usedNumber; } catch (Exception ex) { SystemlogMgr.Error("获取跨服活动信息", ex); response.Code = (int)MessageCode.NbParameterError; } return(response); }
/// <summary> /// 获取我的拍卖列表 /// </summary> /// <param name="managerId"></param> /// <param name="zoneName"></param> /// <returns></returns> public AuctionItemResponse GetMyAuctionList(Guid managerId, string zoneName) { var response = new AuctionItemResponse(); response.Data = new AuctionItemEntity(); try { var manager = NbManagerMgr.GetById(managerId, zoneName); if (manager == null) { return(ResponseHelper.Create <AuctionItemResponse>(MessageCode.AdMissManager)); } if (!IsOpen(managerId, zoneName, manager)) { return(ResponseHelper.Create <AuctionItemResponse>(MessageCode.TransferNotOpen)); } //已经挂牌了多少个 var number = TransferMainMgr.GetTransferNumber(managerId); //最多可以挂牌多少个 var gambleCountMax = CacheFactory.VipdicCache.GetEffectValue(manager.VipLevel, EnumVipEffect.TransferNumber); response.Data.MyTransferList = GetMyTransfer(managerId); response.Data.MaxTransferNumber = gambleCountMax; response.Data.HaveTransferNumber = number; var goldBarEntity = ScoutingGoldbarMgr.GetById(managerId, zoneName); if (goldBarEntity != null) { response.Data.MyGoldBar = goldBarEntity.GoldBarNumber; } } catch (Exception ex) { SystemlogMgr.Error("获取我的拍卖列表", ex); response.Code = (int)MessageCode.NbParameterError; } return(response); }
void BindData() { var accountData = Master.GetAccount(); if (accountData == null) { Master.ShowMessage("请先选择经理."); return; } var manager = NbManagerMgr.GetById(accountData.ManagerId, accountData.ZoneId); if (manager == null) { Master.ShowMessage("获取经理信息失败."); return; } ClearData(); lblCoin.Text = manager.Coin.ToString(); lblExp.Text = manager.EXP.ToString(); lblLevel.Text = manager.Level.ToString(); lblLogo.Text = manager.Logo.ToString(); lblName.Text = manager.Name; lblReiki.Text = manager.Reiki.ToString(); lblSophisticate.Text = manager.Sophisticate.ToString(); lblStatus.Text = CacheDataHelper.Instance.GetEnumDescription("EnumManagerStatus", manager.Status); lblSubstitute.Text = (manager.TeammemberMax - 11).ToString(); lblVipLevel.Text = manager.VipLevel.ToString(); var payAccount = PayUserMgr.GetById(accountData.Account, accountData.ZoneId); if (payAccount != null) { lblCash.Text = payAccount.TotalCash.ToString(); lblPoint.Text = string.Format("{0}+{1}(赠送)={2}", payAccount.Point, payAccount.Bonus, payAccount.TotalPoint); } var user = NbUserMgr.GetById(accountData.Account, accountData.ZoneId); if (user != null) { lblLastLoginTime.Text = user.LastLoginTime.ToString(AdminMgr.TimeFormat); lblRegisterTime.Text = user.RowTime.ToString(AdminMgr.TimeFormat); lblLoginday.Text = user.ContinuingLoginDay.ToString(); } var onlineEntity = OnlineInfoMgr.GetById(accountData.ManagerId, accountData.ZoneId); if (onlineEntity != null) { lblOnlineStatus.Text = onlineEntity.IsOnline ? "在线" : "不在线"; var total = onlineEntity.RealTotalMinutes; var day = total / 1440; var hour = (total % 1440) / 60; var minute = ((total % 1440) % 60); lblOnlineTotal.Text = string.Format("{0} 天 {1} 小时 {2} 分钟", day, hour, minute); lblOnlineCur.Text = onlineEntity.TodayMinutes + " 分钟"; } else { lblOnlineStatus.Text = "无记录"; } var solution = NbSolutionMgr.GetById(accountData.ManagerId, accountData.ZoneId); string playerString = ""; if (solution != null) { var formation = CacheFactory.FormationCache.GetFormation(solution.FormationId); lblSolution.Text = formation == null?solution.FormationId.ToString() : formation.Name; lblSolutionPlayer.Text = solution.PlayerString; lblSolutionSkill.Text = solution.SkillString; playerString = solution.PlayerString; } var managerExtra = NbManagerextraMgr.GetById(accountData.ManagerId, accountData.ZoneId); if (managerExtra != null) { ManagerUtil.CalCurrentStamina(managerExtra, manager.Level, manager.VipLevel); lblStamina.Text = managerExtra.Stamina.ToString(); } var teammembers = TeammemberMgr.GetByManager(accountData.ManagerId, accountData.Mod, accountData.ZoneId); if (teammembers != null) { foreach (var teammember in teammembers) { teammember.Name = AdminCache.Instance.GetPlayerName(teammember.PlayerId); teammember.IsMain = playerString.Contains(teammember.PlayerId.ToString()); } datagrid1.DataSource = teammembers; datagrid1.DataBind(); } var list = FriendinviteMgr.InviteManagerList(manager.Account, accountData.ZoneId); if (list != null) { var friendInviteString = ""; foreach (var item in list) { friendInviteString += item.Name + ","; } lblFriendInvite.Text = friendInviteString; } }
CrosscrowdManagerEntity InnerGetManager(string siteId, Guid managerId, int crowdId, DateTime curTime) { var crowdManager = CrosscrowdManagerMgr.GetById(managerId); int domainId = 1; if (crowdManager == null) { var manager = NbManagerMgr.GetById(managerId, siteId); if (manager == null) { return(null); } //if (!ManagerUtil.CheckFunction(siteId, managerId, EnumOpenFunction.Crowd)) // return null; CrossSiteCache.Instance().TryGetDomainId(siteId, out domainId); crowdManager = new CrosscrowdManagerEntity(); crowdManager.DomainId = domainId; crowdManager.SiteId = siteId; crowdManager.SiteName = CacheFactory.FunctionAppCache.GetCrossZoneName(siteId); crowdManager.Name = manager.Name; crowdManager.Logo = manager.Logo; crowdManager.CrossCrowdId = crowdId; crowdManager.Morale = _initMorale; crowdManager.ManagerId = managerId; crowdManager.RowTime = curTime; crowdManager.UpdateTime = curTime; crowdManager.ScoreUpdateTime = curTime; crowdManager.ResurrectionTime = ShareUtil.BaseTime; crowdManager.NextMatchTime = ShareUtil.BaseTime; crowdManager.Kpi = ManagerUtil.GetKpi(managerId, siteId); CrosscrowdManagerMgr.Insert(crowdManager); } else if (crowdId > 0) { if (crowdManager.CrossCrowdId != crowdId) { CrossSiteCache.Instance().TryGetDomainId(siteId, out domainId); crowdManager.DomainId = domainId; crowdManager.CrossCrowdId = crowdId; crowdManager.KillNumber = 0; crowdManager.ByKillNumber = 0; crowdManager.Morale = _initMorale; crowdManager.Score = 0; crowdManager.ScoreUpdateTime = curTime; crowdManager.UpdateTime = curTime; crowdManager.WinningCount = 0; crowdManager.ResurrectionCount = 0; crowdManager.ResurrectionAuto = 0; crowdManager.ClearCdCount = 0; crowdManager.Kpi = ManagerUtil.GetKpi(managerId, siteId); CrosscrowdManagerMgr.Update(crowdManager); } else if (crowdManager.Morale <= 0) { if (curTime >= crowdManager.ResurrectionTime) { crowdManager.Morale = _initMorale; crowdManager.UpdateTime = curTime; crowdManager.ResurrectionAuto++; CrosscrowdManagerMgr.Update(crowdManager); } else { crowdManager.Morale = 0; } } } return(crowdManager); }
/// <summary> /// 抽奖 /// </summary> /// <param name="managerId"></param> /// <param name="zoneName"></param> /// <returns></returns> public CrossActivityPrizeResponse Prize(Guid managerId, string zoneName) { CrossActivityPrizeResponse response = new CrossActivityPrizeResponse(); response.Data = new CrossActivityPrize(); try { if (!IsActivity) { return(ResponseHelper.Create <CrossActivityPrizeResponse>(MessageCode.CrowdNoData)); } var managerInfo = NbManagerMgr.GetById(managerId, zoneName); if (managerInfo == null) { return(ResponseHelper.Create <CrossActivityPrizeResponse>(MessageCode.NbParameterError)); } var maxCount = CacheFactory.VipdicCache.GetEffectValue(managerInfo.VipLevel, (int)EnumVipEffect.BeThankfulActivity); var usedNumber = CrossactivityRecordMgr.GetActivityNumber(managerId, DateTime.Now.Date); if (maxCount <= usedNumber) { return(ResponseHelper.Create <CrossActivityPrizeResponse>(MessageCode.DayNumberNot)); } var result = Prize(managerInfo.VipLevel); CrossactivityRecordEntity entity = new CrossactivityRecordEntity(0, managerId, zoneName, result.PrizeId, DateTime.Now); ItemPackageFrame package = null; int addPoint = 0; int addGoldBar = 0; int itemCode = 0; int itemCount = 0; var messageCode = AddPrize(result, managerId, zoneName, ref package, ref addPoint, ref addGoldBar, ref itemCode, ref itemCount); if (messageCode != MessageCode.Success) { return(ResponseHelper.Create <CrossActivityPrizeResponse>(messageCode)); } if (addPoint > 0) { messageCode = PayCore.Instance.AddBonus(managerInfo.Account, addPoint, EnumChargeSourceType.CrossActivity, ShareUtil.GenerateComb().ToString(), null, zoneName); if (messageCode != MessageCode.Success) { return(ResponseHelper.Create <CrossActivityPrizeResponse>(messageCode)); } } else if (package != null) { if (!package.Save()) { return(ResponseHelper.Create <CrossActivityPrizeResponse>(MessageCode.NbUpdateFail)); } package.Shadow.Save(); } else if (addGoldBar > 0) { var goldBarManager = ScoutingGoldbarMgr.GetById(managerId, zoneName); if (goldBarManager == null) { goldBarManager = new ScoutingGoldbarEntity(managerId, addGoldBar, 0, 0, 0, DateTime.Now, DateTime.Now); if (!ScoutingGoldbarMgr.Insert(goldBarManager, null, zoneName)) { return(ResponseHelper.Create <CrossActivityPrizeResponse>(MessageCode.NbUpdateFail)); } } else { goldBarManager.GoldBarNumber = goldBarManager.GoldBarNumber + addGoldBar; if (!ScoutingGoldbarMgr.Update(goldBarManager, null, zoneName)) { return(ResponseHelper.Create <CrossActivityPrizeResponse>(MessageCode.NbUpdateFail)); } } } try { CrossactivityRecordMgr.Insert(entity); } catch { } response.Data.MaxNumber = maxCount; response.Data.PrizeId = result.PrizeId; response.Data.UsedNumber = usedNumber + 1; response.Data.Number = itemCount; response.Data.ItemCode = itemCode; } catch (Exception ex) { SystemlogMgr.Error("抽奖", ex); response.Code = (int)MessageCode.NbParameterError; } return(response); }
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); } }
/// <summary> /// 分享游戏奖励(分类) /// </summary> /// <param name="managerId"></param> /// <param name="shareType"></param> /// <returns></returns> public MessageCodeResponse DoShare(Guid managerId, int shareType) { try { DateTime date = DateTime.Now; var manager = NbManagerMgr.GetById(managerId); if (manager == null) { return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.MissManager)); } var shareConfig = CacheFactory.ManagerDataCache.GetShare(shareType); if (shareConfig.Count <= 0) { return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.NbParameterError)); } var entity = ShareManagerMgr.GetByManagerId(managerId, shareType); if (entity != null && !shareConfig[0].IsRepetition) //不可重复领取 { TaskHandler.Instance.Share(managerId); return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.AlreadyShare)); } if (entity != null && entity.ShareNumber >= shareConfig[0].MaxShareNumber) { return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.MaxShareNumber)); } if (shareType == 1) //第一种特殊处理 { if (entity != null) { if (entity.ShareNumber > 0 && (date - entity.UpdateTime).Seconds < 3600) { return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.NowShareNotPrize)); } } } int point = 0; int coin = 0; bool isFirst = false; if (entity == null) //首次分享 { isFirst = true; entity = new ShareManagerEntity(0, managerId, shareType, 1, date, date); } else { entity.ShareNumber++; entity.UpdateTime = date; } var itemList = new Dictionary <int, int>(); var messageCode = SendPrize(shareConfig, isFirst, ref itemList, ref point, ref coin); var mail = new MailBuilder(managerId, point, coin, itemList, EnumMailType.Share); if (messageCode != MessageCode.Success) { return(ResponseHelper.Create <MessageCodeResponse>(messageCode)); } messageCode = SavePrize(entity, mail); return(ResponseHelper.Create <MessageCodeResponse>(messageCode)); } catch (Exception ex) { SystemlogMgr.Error("分享游戏", ex); return(ResponseHelper.Create <MessageCodeResponse>(MessageCode.NbParameterError)); } }
/// <summary> /// 开始拍卖 /// </summary> /// <param name="managerId"></param> /// <param name="zoneName"></param> /// <param name="itemId"></param> /// <param name="price"></param> /// <param name="transferDuration"></param> public AuctionItemResponse AuctionItem(Guid managerId, string zoneName, Guid itemId, int price, int transferDuration) { var response = new AuctionItemResponse(); response.Data = new AuctionItemEntity(); try { DateTime date = DateTime.Now; var manager = NbManagerMgr.GetById(managerId, zoneName); if (manager == null) { return(ResponseHelper.Create <AuctionItemResponse>(MessageCode.AdMissManager)); } if (!IsOpen(managerId, zoneName, manager)) { return(ResponseHelper.Create <AuctionItemResponse>(MessageCode.TransferNotOpen)); } //已经挂牌了多少个 var number = TransferMainMgr.GetTransferNumber(managerId); //最多可以挂牌多少个 var gambleCountMax = CacheFactory.VipdicCache.GetEffectValue(manager.VipLevel, EnumVipEffect.TransferNumber); if (gambleCountMax <= number) { return(ResponseHelper.Create <AuctionItemResponse>(MessageCode.TransferNumberMax)); } var package = ItemCore.Instance.GetPackage(managerId, EnumTransactionType.Transfer, zoneName); if (package == null) { return(ResponseHelper.Create <AuctionItemResponse>(MessageCode.NbNoPackage)); } if (price < 2) { return(ResponseHelper.Create <AuctionItemResponse>(MessageCode.StartPriceSmall)); } var item = package.GetItem(itemId); if (item == null) { return(ResponseHelper.Create <AuctionItemResponse>(MessageCode.ItemNotExists)); } if (!item.IsDeal) { return(ResponseHelper.Create <AuctionItemResponse>(MessageCode.NotDeal)); } var strength = item.GetStrength(); if (strength > 1) { return(ResponseHelper.Create <AuctionItemResponse>(MessageCode.NotDeal)); } var iteminfo = CacheFactory.ItemsdicCache.GetItem(item.ItemCode); if (iteminfo == null) { return(ResponseHelper.Create <AuctionItemResponse>(MessageCode.ItemNotExists)); } //默认86400秒 24小时 TransferMainEntity entity = new TransferMainEntity(ShareUtil.GenerateComb(), _domainId, item.ItemCode, iteminfo.ItemName, new byte[0], manager.Name, managerId, zoneName, price, "", "", 0, Guid.Empty, date, date.AddDays(1), 0, 0, 0, date, date); var messageCode = package.Delete(itemId); if (messageCode != MessageCode.Success) { return(ResponseHelper.Create <AuctionItemResponse>(messageCode)); } if (!package.Save()) { return(ResponseHelper.Create <AuctionItemResponse>(MessageCode.NbUpdateFail)); } if (!TransferMainMgr.Insert(entity)) { messageCode = package.AddItem(item.ItemCode); if (messageCode != MessageCode.Success) { SystemlogMgr.Error("拍卖返还物品失败", "拍卖返还物品失败,managerId:" + managerId + ",zoneName:" + zoneName + "物品ID:" + item.ItemCode); } return(ResponseHelper.Create <AuctionItemResponse>(MessageCode.NbUpdateFail)); } package.Shadow.Save(); entity.TransferDurationTick = ShareUtil.GetTimeTick(entity.TransferDuration); entity.TransferDurationTick = ShareUtil.GetTimeTick(entity.TransferDuration); var modId = ShareUtil.GetTableMod(entity.TransferId); entity.ModId = modId; _tenTransferList.Add(entity); Sort(); response.Data.MyTransferList = GetMyTransfer(managerId); response.Data.MaxTransferNumber = gambleCountMax; response.Data.HaveTransferNumber = number + 1; var goldBarEntity = ScoutingGoldbarMgr.GetById(managerId, zoneName); if (goldBarEntity != null) { response.Data.MyGoldBar = goldBarEntity.GoldBarNumber; } } catch (Exception ex) { SystemlogMgr.Error("开始拍卖", ex); response.Code = (int)MessageCode.NbParameterError; } return(response); }