protected override bool DoSuccess(int userId, out IUser user) { user = null; //原因:重登录时,数据会回档问题 var cacheSet = new PersonalCacheStruct <GameUser>(); GameUser userInfo = cacheSet.FindKey(userId.ToString()); if (userInfo != null) { //原因:还在加载中时,返回 if (userInfo.IsRefreshing) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().ServerLoading; return(false); } } if (userInfo == null || string.IsNullOrEmpty(userInfo.SessionID) || !userInfo.IsOnline) { UserCacheGlobal.Load(userId.ToString()); //重新刷缓存 userInfo = cacheSet.FindKey(userId.ToString()); } if (userInfo != null) { if (userInfo.UserStatus == UserStatus.FengJin) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1004_IDDisable; return(false); } user = new SessionUser(userInfo); //todo //NoticeHelper.RankNotice(userInfo); //公告 CombatHelper.LoadProperty(userInfo); //todo //NoviceHelper.OldFriendPack(Uid, userInfo.LoginTime); //好友礼包 UserLoginLog userLoginLog = new UserLoginLog(); userLoginLog.UserId = userInfo.UserID; userLoginLog.SessionID = Sid; userLoginLog.MobileType = MobileType; userLoginLog.ScreenX = ScreenX; userLoginLog.ScreenY = ScreenY; userLoginLog.RetailId = RetailID; userLoginLog.AddTime = DateTime.Now; userLoginLog.State = LoginStatus.Logined; userLoginLog.DeviceID = DeviceID; userLoginLog.Ip = this.GetRealIP(); userLoginLog.Pid = userInfo.Pid; userLoginLog.UserLv = userInfo.UserLv; //原因:报表统计 userLoginLog.PlotID = userInfo.PlotProgress; PlotInfo plotInfo = new ShareCacheStruct <PlotInfo>().FindKey(userInfo.PlotProgress); if (plotInfo != null) { userLoginLog.PlotName = plotInfo.PlotName; } var sender = DataSyncManager.GetDataSender(); sender.Send(userLoginLog); //int vipLv; //var vipLvArray = new ShareCacheStruct<VipLvInfo>().FindAll(u => u.PayGold <= userInfo.PayGold); //vipLv = vipLvArray.Count > 0 ? vipLvArray[vipLvArray.Count - 1].VipLv : (short)0; userInfo.LoginTime = DateTime.Now; userInfo.SessionID = Sid; userInfo.IsOnline = true; //userInfo.VipLv = vipLv; userInfo.GameId = GameType; userInfo.ServerId = ServerID; userInfo.ChatVesion = 0; userInfo.ChatDate = DateTime.MinValue; userInfo.BroadcastVesion = 0; if (userInfo.DailyLoginTime == MathUtils.SqlMinDate || userInfo.DailyLoginTime.Date != DateTime.Now.Date) { userInfo.DailyLoginTime = DateTime.Now; } //todo RankingHelper.DailySportsRankPrize(userInfo); } else { user = new SessionUser() { UserId = userId, PassportId = PassportId }; ErrorCode = 1005; ErrorInfo = LanguageManager.GetLang().St1005_RoleCheck; } return(true); }