generated from root/miduo_server
优化登录代码
parent
7c7d5ab773
commit
0c5a410977
|
@ -71,6 +71,12 @@ public class GetPlayerInfoHandler extends BaseHandler {
|
|||
userId, token, msgId, msgIndex, getPlayerInfoRequest.getNum(), getPlayerInfoRequest.getStr());
|
||||
|
||||
User user = UserManager.getUser(userId);
|
||||
if (user == null) {
|
||||
LOGGER.error("processMessage->uid={} not found", userId);
|
||||
return;
|
||||
}
|
||||
//同步英雄芯片
|
||||
UserManager.initHeroMedal(user);
|
||||
Poster.getPoster().dispatchEvent(new UserOnlineEvent(userId));
|
||||
GlobalDataManaager.checkNewFunction(user);
|
||||
PlayerLogic.getInstance().sendDayilyMail(user, iSession);
|
||||
|
|
|
@ -293,7 +293,7 @@ public class UserManager {
|
|||
public static User getUser(int uid, boolean canNull) {
|
||||
User user = userMap.get(uid);
|
||||
if (user != null) {
|
||||
initHeroMedal(user);
|
||||
// initHeroMedal(user);
|
||||
return user;
|
||||
}
|
||||
user = MongoUtil.getInstence().getMyMongoTemplate().findById(User.getCollectionName(), uid, User.class);
|
||||
|
@ -304,12 +304,12 @@ public class UserManager {
|
|||
throw new RuntimeException("1-UserManager::getUser null exception:" + uid);
|
||||
}
|
||||
|
||||
initHeroMedal(user);
|
||||
// initHeroMedal(user);
|
||||
UserManager.addUser(user);
|
||||
return user;
|
||||
}
|
||||
|
||||
private static void initHeroMedal(User user) {
|
||||
public static void initHeroMedal(User user) {
|
||||
user.getHeroManager().getHeroMap().forEach((k, hero)-> {
|
||||
hero.getMedalPosToMap().forEach((pos, medalId) -> {
|
||||
Medal medal = user.getMedalManager().getMedalMap().get(medalId);
|
||||
|
@ -379,7 +379,6 @@ public class UserManager {
|
|||
public static User getUserOnlyInMap(int uid, boolean canNull) {
|
||||
User user = userMap.get(uid);
|
||||
if (user != null) {
|
||||
initHeroMedal(user);
|
||||
return user;
|
||||
}
|
||||
return user;
|
||||
|
|
Loading…
Reference in New Issue