void BindData() { try { var zone = AdminMgr.GetSelectZoneIdInt(HttpContext.Current, ddlZone); var startTime = DateTime.Today.AddDays(-15); var endTime = DateTime.Today; var list = StatisticKpiMgr.GetbyDate(zone, startTime, endTime); for (int i = 0; i < list.Count; i++) { list[i].RetentionPercent2 = list[i].Retention2.ToString() + " " + GetPercent(list[i].Retention2, i, list); list[i].RetentionPercent3 = list[i].Retention3.ToString() + " " + GetPercent(list[i].Retention3, i, list); list[i].RetentionPercent4 = list[i].Retention4.ToString() + " " + GetPercent(list[i].Retention4, i, list); list[i].RetentionPercent5 = list[i].Retention5.ToString() + " " + GetPercent(list[i].Retention5, i, list); list[i].RetentionPercent6 = list[i].Retention6.ToString() + " " + GetPercent(list[i].Retention6, i, list); list[i].RetentionPercent7 = list[i].Retention7.ToString() + " " + GetPercent(list[i].Retention7, i, list); list[i].RetentionPercent15 = list[i].Retention15.ToString() + " " + GetPercent(list[i].Retention7, i, list); list[i].RetentionPercent30 = list[i].Retention30.ToString() + " " + GetPercent(list[i].Retention7, i, list); } datagrid2.DataSource = list; datagrid2.DataBind(); lblInviteNumber.Text = FriendinviteMgr.GetAllNumber(ddlZone.SelectedValue).ToString(); } catch (Exception ex) { LogHelper.Insert(ex); } }
public MessageCode GetKpiImmediate(DateTime curTime, int zoneId, string siteName = "") { try { string recordMonth = curTime.ToString("yyyyMM"); int registerUser = 0; int registerManager = 0; int dau = 0; int dUniqueIp = 0; int dNewUser = 0; int dNewManager = 0; int curOnline = 0; int payUserCount = 0; int payCount = 0; int payTotal = 0; long paySum = 0; int payFirst = 0; NbUserMgr.GetKpiImmediate(curTime, ref registerUser, ref registerManager, ref dau, ref dUniqueIp, ref dNewUser, ref dNewManager, ref payUserCount, ref payCount, ref payTotal, ref paySum, ref payFirst, ref curOnline, null, siteName); StatisticKpiMgr.UpdateImmediate(zoneId, recordMonth, curTime.Date, registerUser, registerManager, dau, dUniqueIp, dNewUser, dNewManager, payUserCount, payCount, payTotal, paySum, payFirst, curOnline, curTime); return(MessageCode.Success); } catch (Exception ex) { SystemlogMgr.Error("GetKpiImmediate", ex); return(MessageCode.Exception); } }
public void Testw1() { try { var list = StatisticKpiMgr.GetbyDate(0, DateTime.Now.AddDays(-5), DateTime.Now); var r = list; var rr = r; } catch (Exception e) { var r = e; var ee = r; } }
void BindDetail(DateTime recordDate) { try { var list = StatisticKpiMgr.GetbyDate(1, recordDate, recordDate); datagrid3.DataSource = list; datagrid3.DataBind(); ltlMessage.Text = ""; } catch (Exception ex) { LogHelper.Insert(ex); ShowMessage(ex.Message); } }
protected void btnSearch_Click(object sender, EventArgs e) { try { var zone = AdminMgr.GetSelectZoneIdInt(HttpContext.Current, ddlZone); var starTime = Convert.ToDateTime(txtStartTime.Value); var endTime = Convert.ToDateTime(txtEndTime.Value); var list = StatisticKpiMgr.GetbyDate(zone, starTime, endTime); if (list != null && list.Count > 0) { for (int i = 0; i < list.Count; i++) { list[i].RetentionPercent2 = list[i].Retention2.ToString() + " " + GetPercent(list[i].Retention2, i, list); list[i].RetentionPercent3 = list[i].Retention3.ToString() + " " + GetPercent(list[i].Retention3, i, list); list[i].RetentionPercent4 = list[i].Retention4.ToString() + " " + GetPercent(list[i].Retention4, i, list); list[i].RetentionPercent5 = list[i].Retention5.ToString() + " " + GetPercent(list[i].Retention5, i, list); list[i].RetentionPercent6 = list[i].Retention6.ToString() + " " + GetPercent(list[i].Retention6, i, list); list[i].RetentionPercent7 = list[i].Retention7.ToString() + " " + GetPercent(list[i].Retention7, i, list); list[i].RetentionPercent15 = list[i].Retention15.ToString() + " " + GetPercent(list[i].Retention7, i, list); list[i].RetentionPercent30 = list[i].Retention30.ToString() + " " + GetPercent(list[i].Retention7, i, list); } var total = new StatisticKpiEntity(); total.RecordDateStr = "合计"; foreach (var entity in list) { total.Dau += entity.Dau; total.DNewUser += entity.DNewUser; total.DNewManager += entity.DNewManager; total.PayTotal += entity.PayTotal; total.Pcu += entity.Pcu; total.Acu += entity.Acu; total.PointRemain += entity.PointRemain; total.PointConsume += entity.PointConsume; total.PointCirculate += entity.PointCirculate; total.RecordDate = DateTime.MinValue; } list.Add(total); } datagrid2.DataSource = list; datagrid2.DataBind(); ltlMessage.Text = ""; } catch (Exception ex) { LogHelper.Insert(ex); ShowMessage(ex.Message); } }
void BindData() { try { var zone = AdminMgr.GetSelectZoneIdInt(HttpContext.Current, ddlZone); var startTime = DateTime.Today.AddDays(-5); var endTime = DateTime.Today; var list = StatisticKpiMgr.GetbyDate(zone, startTime, endTime); datagrid1.DataSource = list; datagrid1.DataBind(); } catch (Exception ex) { LogHelper.Insert(ex); } }
public MessageCode JobCreateRecord() { try { StatisticDetailMgr.Create(ShareUtil.ZoneId, DateTime.Today); StatisticKpiMgr.Create(ShareUtil.ZoneId, DateTime.Today); StatisticOnlineMgr.Create(ShareUtil.ZoneId, DateTime.Today); StatisticInfoMgr.Create(ShareUtil.ZoneId); return(MessageCode.Success); } catch (Exception ex) { SystemlogMgr.Error("JobCreateRecord", ex); return(MessageCode.Exception); } }
public void OpenGamble() { try { var time1 = DateTime.ParseExact("20160601", "yyyyMMdd", null); var time2 = DateTime.ParseExact("20160611", "yyyyMMdd", null); var starTime = Convert.ToDateTime(time1); var endTime = Convert.ToDateTime(time2); var list = StatisticKpiMgr.GetbyDate(1, starTime, endTime); foreach (var VARIABLE in list) { } } catch (Exception ex) { } }
/// <summary> /// 保存金币增加记录 /// </summary> /// <param name="managerId"></param> /// <param name="coin"></param> /// <param name="chargeSourceType"></param> /// <param name="orderId">用于关联源记录参考</param> /// <returns></returns> public static bool SaveCoinCharge(Guid managerId, int coin, int exp, bool isLevelup, int level, int chargeSourceType, string orderId) { if (!CacheFactory.AppsettingCache.ShadowCoin) { return(true); } try { //统计金币 StatisticKpiMgr.UpdateSame(ShareUtil.ZoneId, DateTime.Now.Date, 0, 0, 0, coin); var provider = new ShadowProvider(); return(provider.SaveCoinCharge(managerId, coin, exp, isLevelup, level, chargeSourceType, orderId)); } catch (Exception ex) { SystemlogMgr.Error("SaveCoinCharge", ex); return(false); } }
void BindData() { try { var zone = AdminMgr.GetSelectZoneIdInt(HttpContext.Current, ddlZone); var starTime = Convert.ToDateTime(txtStartTime.Value); var endTime = Convert.ToDateTime(txtEndTime.Value); var list = StatisticKpiMgr.GetbyDate(zone, starTime, endTime); for (int i = 0; i < list.Count; i++) { var c = list[i].CoinConsume; list[i].CoinConsume = c * -1; } datagrid2.DataSource = list; datagrid2.DataBind(); } catch (Exception ex) { LogHelper.Insert(ex); } }
protected void btnSearch_Click(object sender, EventArgs e) { try { var zone = AdminMgr.GetSelectZoneIdInt(HttpContext.Current, ddlZone); var starTime = Convert.ToDateTime(txtStartTime.Value); var endTime = Convert.ToDateTime(txtEndTime.Value); var list = StatisticKpiMgr.GetbyDate(zone, starTime, endTime); if (list != null && list.Count > 0) { var total = new StatisticKpiEntity(); total.RecordDateStr = "合计"; foreach (var entity in list) { total.Dau += entity.Dau; total.DNewUser += entity.DNewUser; total.DNewManager += entity.DNewManager; total.PayTotal += entity.PayTotal; total.Pcu += entity.Pcu; total.Acu += entity.Acu; total.PointRemain += entity.PointRemain; total.PointConsume += entity.PointConsume; total.PointCirculate += entity.PointCirculate; total.RecordDate = DateTime.MinValue; } list.Add(total); } datagridzone.DataSource = list; datagridzone.DataBind(); ltlMessage.Text = ""; } catch (Exception ex) { LogHelper.Insert(ex); ShowMessage(ex.Message); } }
public MessageCode MatchCallback(BaseMatchData matchData, long revengeRecordId, PlayerKillOpponentEntity awayOpp, PlayerkillInfoEntity info) { var pkmatchData = matchData; if (pkmatchData == null || pkmatchData.ErrorCode != (int)MessageCode.Success) { return(MessageCode.MatchCreateFail); } bool isrevenge = false; Guid lotteryMatchId = Guid.Empty; var winType = ShareUtil.CalWinType(pkmatchData.Home.Score, pkmatchData.Away.Score); int win = 0; int lose = 0; int draw = 0; int prizeExp = 0; int prizeCoin = 0; if (!isrevenge) { if (winType == EnumWinType.Win) { win = 1; } if (winType == EnumWinType.Lose) { lose = 1; } if (winType == EnumWinType.Draw) { draw = 1; } var prize = CacheFactory.PlayerKillCache.GetPrize(winType); prizeCoin = prize.Coin; prizeExp = prize.Exp; } int prizeItemCode = 0; string prizeItemString = ""; var manager = ManagerCore.Instance.GetManager(pkmatchData.Home.ManagerId); var managerex = ManagerCore.Instance.GetManagerExtra(pkmatchData.Home.ManagerId); var subtype = 1; if (manager.Level % 10 == 0) { subtype = manager.Level / 10; } else { subtype = manager.Level / 10 + 1; } int matchTimes = 0; PlayerkillInfoMgr.GetMatchTimes(manager.Idx, ref matchTimes); //if (winType == EnumWinType.Win) //{ var lotteryEntity = CacheFactory.LotteryCache.LotteryFive(EnumLotteryType.PlayerKill, subtype); int pointCount = 0; if (lotteryEntity != null) { //第一场友谊赛固定获得5钻石 if (matchTimes == 0) { prizeItemCode = 810001; pointCount = 5; lotteryMatchId = pkmatchData.MatchId; } else { if (winType == EnumWinType.Win) { prizeItemCode = lotteryEntity.PrizeItemCode; prizeItemString = lotteryEntity.ItemString; if (prizeItemCode == 810001) { var pointConfig = CacheFactory.PlayerKillCache.GetPointConfig(manager.VipLevel); if (pointConfig != null && (info.DayPoint + pointCount) < pointConfig.TotalPoint) { pointCount = pointConfig.PrizePoint; int point = pointCount; //欧洲杯狂欢 ActivityExThread.Instance.EuropeCarnival(5, ref point); info.DayPoint = info.DayPoint + point; info.DayPoint = info.DayPoint > pointConfig.TotalPoint ? pointConfig.TotalPoint : info.DayPoint; } else { prizeItemCode = 910001; pointCount = 5; } } else if (prizeItemCode == 910001) { prizeItemCode = 910001; pointCount = 5; } var itemcode = ActivityExThread.Instance.SummerGiftBag(4); if (itemcode > 0) { prizeItemCode = itemcode; } else { itemcode = ActivityExThread.Instance.MidAutumnActivity(4, info.SpecialItemNumber); if (itemcode > 0) { info.SpecialItemNumber++; prizeItemCode = itemcode; } } lotteryMatchId = pkmatchData.MatchId; } } } //} //LogHelper.Insert("友谊赛比赛结果处理请求:比赛id"+lotteryMatchId+",ManagerId:" + pkmatchData.Home.ManagerId.ToString() + " ,对手Id:" + pkmatchData.Away.ManagerId.ToString(), LogType.Info); double totalPlusRate = 0; //是否有vip效果 var vipRate = CacheFactory.VipdicCache.GetEffectValue(manager.VipLevel, EnumVipEffect.PkOrLeagueExpPlus); totalPlusRate += vipRate / 100.00; //是否有增加经验的Buff var buffExp = BuffPoolCore.Instance().GetBuffValue(manager.Idx, EnumBuffCode.PkMatchExp, true, false); NbManagerbuffpoolEntity buffExpEntity = null; if (buffExp != null) { if (buffExp.SrcList != null && buffExp.SrcList.Count > 0) { buffExpEntity = NbManagerbuffpoolMgr.GetById(buffExp.SrcList[0].Idx); if (buffExpEntity != null && buffExpEntity.RemainTimes > 0) { totalPlusRate += buffExp.Percent; } } } prizeExp = (int)(prizeExp * (1 + totalPlusRate)); if (matchData.Home.Score > matchData.Away.Score) { awayOpp.HasWin = true; info.OpponentInfo = SerializationHelper.ToByte(info.Opponents); //PlayerkillInfoMgr.Update(info); } //欧洲杯狂欢 ActivityExThread.Instance.EuropeCarnival(1, ref prizeExp); LogHelper.Insert(string.Format("revengeId:{0},score1:{1},score2:{2},haswin:{3}", revengeRecordId, matchData.Home.Score, matchData.Away.Score, awayOpp.HasWin), LogType.Info); OnlineCore.Instance.CalIndulgePrize(manager, ref prizeExp, ref prizeCoin); ManagerUtil.AddManagerData(manager, prizeExp, prizeCoin, 0, EnumCoinChargeSourceType.PlayerKillPrize, pkmatchData.MatchId.ToString()); long outRevengeRecordId = 0; //扣除行动力 var code = ManagerCore.Instance.SubStamina(managerex, _pkStamina, manager.Level, manager.VipLevel); if (code != MessageCode.Success) { return(code); } code = SaveMatch(manager, managerex, pkmatchData, lotteryMatchId, win, lose, draw, prizeExp, prizeCoin, prizeItemCode, prizeItemString, isrevenge, revengeRecordId, ref outRevengeRecordId, info, pointCount); //统计使用的行动力 StatisticKpiMgr.UpdateSame(ShareUtil.ZoneId, DateTime.Now.Date, 0, _pkStamina, 0, 0); if (code == MessageCode.Success) { //更新祝福Buff剩余场次数 if (buffExpEntity != null && buffExpEntity.RemainTimes > 0) { buffExpEntity.RemainTimes--; NbManagerbuffpoolMgr.Update(buffExpEntity); } //记录比赛数据 MatchCore.SaveMatchStat(pkmatchData.Home.ManagerId, EnumMatchType.PlayerKill, pkmatchData.Home.Score, pkmatchData.Away.Score, pkmatchData.Home.Score); //记录成就相关数据 AchievementTaskCore.Instance.UpdatePkMatchGoals(manager.Idx, pkmatchData.Home.Score); TaskHandler.Instance.PkOrFriendMatchCount(manager.Idx); var popList = ManagerUtil.SaveManagerAfter(manager, false); var taskPop = TaskHandler.Instance.PlayerKillFight(manager.Idx, (int)winType); if (matchData.HasTask) { //var taskPop = TaskHandler.Instance.PlayerKillFight(manager.Idx, (int)winType); if (taskPop != null && taskPop.Count > 0) { if (popList == null) { popList = taskPop; } else { popList.AddRange(taskPop); } } } MemcachedFactory.MatchPopClient.Set(matchData.MatchId, popList); } return(code); }
public MessageCode GetKpi(DateTime curTime, DateTime recordTime, int zoneId, string siteName = "") { try { string recordMonth = recordTime.ToString("yyyyMM"); int totalUser = 0; int totalManager = 0; int dau = 0; int dUniqueIp = 0; int dNewUser = 0; int dNewManager = 0; int dLostUser7 = 0; int dLostUser15 = 0; int dLostUser30 = 0; int retention2 = 0; int retention3 = 0; int retention4 = 0; int retention5 = 0; int retention6 = 0; int retention7 = 0; int retention15 = 0; int retention30 = 0; int wau = 0; int wLost = 0; int wHonor = 0; int wHonorLost = 0; int mau = 0; int payUserCount = 0; int payCount = 0; int payTotal = 0; long paySum = 0; int payFirst = 0; int payWLost = 0; int lTV = 0; long pointRemain = 0; long pointConsume = 0; long pointCirculate = 0; int getPoint = 0; long getCoin = 0; long coinConsume = 0; int energyConsume = 0; for (int i = 0; i > -31; i--) { try { var time = recordTime.AddDays(i); NbUserMgr.GetKpi(time, ref totalUser, ref totalManager, ref dau, ref dUniqueIp, ref dNewUser, ref dNewManager, ref dLostUser7, ref dLostUser15, ref dLostUser30, ref retention2, ref retention3, ref retention4, ref retention5, ref retention6, ref retention7, ref retention15, ref retention30, ref wau, ref wLost, ref wHonor, ref wHonorLost, ref mau, ref payUserCount, ref payCount, ref payTotal, ref paySum, ref payFirst, ref payWLost, ref lTV, ref pointRemain, ref pointConsume, ref pointCirculate, null, siteName); StatisticKpiMgr.Update(zoneId, recordMonth, time.Date, totalUser, totalManager, dau, dUniqueIp, dNewUser, dNewManager, dLostUser7, dLostUser15, dLostUser30, retention2, retention3, retention4, retention5, retention6, retention7, retention15, retention30, wau, wLost, wHonor, wHonorLost, mau, payUserCount, payCount, payTotal, paySum, payFirst, pointRemain, pointConsume, pointCirculate, curTime); } catch (Exception ex) { } } return(MessageCode.Success); } catch (Exception ex) { SystemlogMgr.Error("JobGetKpi", ex); return(MessageCode.Exception); } }