public MessageCode GetDetail(DateTime curTime, DateTime recordTime) { try { int loginUser = 0; int chargeUser = 0; int chargeCash = 0; int consumePoint = 0; int newUser = 0; int newMangaer = 0; var hour = recordTime.Hour; var starTime = recordTime.Date.AddHours(hour); var endTime = starTime.AddHours(1).AddMilliseconds(-3); NbUserMgr.GetDetail(starTime, endTime, ref loginUser, ref chargeUser, ref chargeCash, ref consumePoint, ref newUser, ref newMangaer); var hourStr = hour.ToString(); SaveDetail(EnumAnalyseType.Login, loginUser, curTime, recordTime, hourStr); SaveDetail(EnumAnalyseType.ChargeUser, chargeUser, curTime, recordTime, hourStr); SaveDetail(EnumAnalyseType.ChargeCash, chargeCash, curTime, recordTime, hourStr); SaveDetail(EnumAnalyseType.ConsumePoint, consumePoint, curTime, recordTime, hourStr); SaveDetail(EnumAnalyseType.NewUser, newUser, curTime, recordTime, hourStr); SaveDetail(EnumAnalyseType.NewManager, newMangaer, curTime, recordTime, hourStr); return(MessageCode.Success); } catch (Exception ex) { SystemlogMgr.Error("JobGetDetail", ex); return(MessageCode.Exception); } }
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 MessageCode JobGetTotal() { int totalUser = 0; int totalManager = 0; long totalPay = 0; long pointRemain = 0; long onlineMinutes = 0; NbUserMgr.GetTotal(ref totalUser, ref totalManager, ref totalPay, ref pointRemain, ref onlineMinutes); StatisticInfoMgr.Update(ShareUtil.ZoneId, totalUser, totalManager, totalPay, pointRemain, onlineMinutes, DateTime.Now); return(MessageCode.Success); }
public MessageCode JobGetOnlineData() { try { int userCount = 0; long totalTime = 0; DateTime curTime = DateTime.Now; NbUserMgr.GetOnline(ref userCount, ref totalTime); var hour = curTime.Hour; StatisticOnlineMgr.Update(ShareUtil.ZoneId, hour.ToString(), curTime.Date, curTime, userCount, totalTime); return(MessageCode.Success); } catch (Exception ex) { SystemlogMgr.Error("JobGetOnlineData", ex); return(MessageCode.Exception); } return(MessageCode.Exception); }
private bool doLogin() { try { var platformId = ddlPlatform.SelectedValue; var user = NbUserMgr.GetByAccount(UserName, Request.UserHostAddress, DateTime.Today.AddDays(-1), DateTime.Today, 0); var sessionId = ShareUtil.GenerateComb().ToString(); if (user != null) { UserAccountEntity userAccountEntity = new UserAccountEntity(user.Account, Guid.Empty, "", 1, platformId, sessionId); userAccountEntity.ExtraData = "d|pengyou|f"; FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, user.Account, DateTime.Now, DateTime.Now.AddDays(10), false, userAccountEntity.ToString(), FormsAuthentication .FormsCookiePath); var cookie = FormsAuthentication.Encrypt(ticket); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, cookie)); // OnlineMgr.LoginSession(info.Data.ManagerInfo.Manager.Idx, sessionId); return(true); } else { ResponseMessage("用户名不存在"); return(false); } } catch (Exception ex) { LogHelper.Insert(ex); ResponseMessage(ex.Message); return(false); } }
private bool doLoginNew(ref string cookie) { try { TxLogininfoEntity tLoginInfo = null; var platformId = GetParam("platform"); var userName = GetParam("openid"); if (ShareUtil.IsQunHei) { userName = GetParam("username"); } //if (userName.Length>0 && userName.Contains("h5_zhiqu")) // return false; var user = NbUserMgr.GetByAccount(userName, GetIp(), DateTime.Today.AddDays(-1), DateTime.Today, 0); var sessionId = ShareUtil.GenerateComb().ToString(); if (user != null) { UserAccountEntity userAccountEntity = new UserAccountEntity(user.Account, Guid.Empty, "", 1, platformId, sessionId); userAccountEntity.ExtraData = "d|pengyou|f"; var info = reader.GetManagerInfoByAccount(userAccountEntity.Account, GetIp(), UAFactory.Instance.IsTx); if (info.Code == (int)MessageCode.Success) { if (info.Data.NeedSelect == false) { if (ShareUtil.IsTx) { string openKey = GetParam("openkey"); string pf = GetParam("pf"); if (string.IsNullOrEmpty(pf)) { pf = "wanba_ts"; } string platform = GetParam("platform"); //userip //sig int appId = UAFactory.Instance.TxAppId; string appKey = UAFactory.Instance.TxAppKey; var result = WbUserInfo(userName, openKey, pf, platform, appId, appKey); if (result != 0) { OutputHelper.Output(result); } tLoginInfo = new TxLogininfoEntity(userName, openKey, pf, platform, "", "", DateTime.Now, DateTime.Now); } if (info.Data.ManagerInfo == null) { string playerName = ""; string logo = "1"; int templateId = 1; var createData = reader.CreateManager(UserAccount.Account, playerName, logo, templateId, UAHelper.GetRealIP()); if (createData.Code != (int)MessageCode.Success) { info.Code = createData.Code; OutputHelper.Output(info); } info = reader.GetManagerInfoByAccount(UserAccount.Account, GetIp(), UAFactory.Instance.IsTx);; } try { if (ShareUtil.IsH5A8) { UA_A8.UserAction("entergame", info.Data.ManagerInfo.Manager.Account, "", "", info.Data.ManagerInfo.Manager); } } catch (Exception) { } if (CheckLockState(info.Data.ManagerInfo.Manager.Idx)) { OutputHelper.Output(MessageCode.LoginOnlineLock); } //写入登录信息 cookie = UAHelper.SetFormsAuthentication(userAccountEntity.Account, info.Data.ManagerInfo.Manager.Idx, info.Data.ManagerInfo.Manager.Name, 1, sessionId); OnlineMgr.LoginSession(info.Data.ManagerInfo.Manager.Idx, sessionId); onlineClient.RiseOnlineTime(info.Data.ManagerInfo.Manager.Idx); info.Data.Cookie = cookie; Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, cookie)); var isSubscribe = GetParamBool("isSubscribe"); if (isSubscribe)//关注 { activityClient.DoShare(info.Data.ManagerInfo.Manager.Idx, 4); } if (ShareUtil.IsTx) { TxLogininfoMgr.InsertUpdate(tLoginInfo); } return(true); } return(true); } else { FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, user.Account, DateTime.Now, DateTime.Now.AddDays(10), false, userAccountEntity.ToString(), FormsAuthentication .FormsCookiePath); cookie = FormsAuthentication.Encrypt(ticket); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, cookie)); return(false); } } return(false); } catch (Exception ex) { cookie = ex.ToString(); return(true); } }
private bool doLogin(ref string cookie) { try { var platformId = GetParam("platform"); var userName = GetParamNOUrlDecode("username"); //if (userName.Length > 0 && userName.Contains("h5_zhiqu")) // return false; var user = NbUserMgr.GetByAccount(userName, GetIp(), DateTime.Today.AddDays(-1), DateTime.Today, 0); var sessionId = ShareUtil.GenerateComb().ToString(); if (user != null) { UserAccountEntity userAccountEntity = new UserAccountEntity(user.Account, Guid.Empty, "", 1, platformId, sessionId); userAccountEntity.ExtraData = "d|pengyou|f"; var info = reader.GetManagerInfoByAccount(userAccountEntity.Account, GetIp(), UAFactory.Instance.IsTx); if (info.Code == (int)MessageCode.Success) { if (info.Data.NeedSelect == false) { if (info.Data.ManagerInfo == null) { string playerName = ""; string logo = "1"; int templateId = 1; var createData = reader.CreateManager(UserAccount.Account, playerName, logo, templateId, UAHelper.GetRealIP()); if (createData.Code != (int)MessageCode.Success) { info.Code = createData.Code; OutputHelper.Output(info); } info = reader.GetManagerInfoByAccount(UserAccount.Account, GetIp(), UAFactory.Instance.IsTx);; } if (CheckLockState(info.Data.ManagerInfo.Manager.Idx)) { OutputHelper.Output(MessageCode.LoginOnlineLock); } //写入登录信息 cookie = UAHelper.SetFormsAuthentication(userAccountEntity.Account, info.Data.ManagerInfo.Manager.Idx, info.Data.ManagerInfo.Manager.Name, 1, sessionId); OnlineMgr.LoginSession(info.Data.ManagerInfo.Manager.Idx, sessionId); onlineClient.RiseOnlineTime(info.Data.ManagerInfo.Manager.Idx); info.Data.Cookie = cookie; Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, cookie)); return(true); } return(true); } else { FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, user.Account, DateTime.Now, DateTime.Now.AddDays(10), false, userAccountEntity.ToString(), FormsAuthentication .FormsCookiePath); cookie = FormsAuthentication.Encrypt(ticket); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, cookie)); return(false); } } return(false); } catch (Exception ex) { cookie = ex.ToString(); return(true); } }
void UpdateActiveCache(Guid managerId) { if (syncClose || syncUpdating) { return; } OnlineInfoEntity actObj = null; if (lockCache.TryEnterReadLock(OnlineConfig.TIMEWaitLock)) { try { cacheActive.TryGetValue(managerId, out actObj); } finally { lockCache.ExitReadLock(); } } if (actObj == null) { if (lockCache.TryEnterWriteLock(OnlineConfig.TIMEWaitLock)) { try { OnlineInfoEntity newObj = new OnlineInfoEntity(managerId, DateTime.Now); cacheActive[managerId] = newObj; OnlineCore.LoginOnline(managerId); } finally { lockCache.ExitWriteLock(); } } } else { bool isCrossDay = false; DateTime curTime = DateTime.Now; DateTime today = curTime.Date; if (lockCache.TryEnterReadLock(OnlineConfig.TIMEWaitLock)) { try { lock (actObj) { if (!actObj.IsHandlerCrossDay && actObj.GuildInTime.Date.AddDays(1) == today)//跨天 { actObj.IsHandlerCrossDay = true; isCrossDay = true; } actObj.ActiveTime = curTime; } } finally { lockCache.ExitReadLock(); } } if (isCrossDay) { try { var manager = ManagerCore.Instance.GetManager(managerId); if (manager == null) { return; } NbUserMgr.UpdateContinueday(manager.Idx, manager.Account, today.AddDays(-1), today); } catch (Exception ex) { LogHelper.Insert(ex); } } } }
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; } }
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); } }