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());
|
userId, token, msgId, msgIndex, getPlayerInfoRequest.getNum(), getPlayerInfoRequest.getStr());
|
||||||
|
|
||||||
User user = UserManager.getUser(userId);
|
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));
|
Poster.getPoster().dispatchEvent(new UserOnlineEvent(userId));
|
||||||
GlobalDataManaager.checkNewFunction(user);
|
GlobalDataManaager.checkNewFunction(user);
|
||||||
PlayerLogic.getInstance().sendDayilyMail(user, iSession);
|
PlayerLogic.getInstance().sendDayilyMail(user, iSession);
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,7 @@ public class UserManager {
|
||||||
public static User getUser(int uid, boolean canNull) {
|
public static User getUser(int uid, boolean canNull) {
|
||||||
User user = userMap.get(uid);
|
User user = userMap.get(uid);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
initHeroMedal(user);
|
// initHeroMedal(user);
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
user = MongoUtil.getInstence().getMyMongoTemplate().findById(User.getCollectionName(), uid, User.class);
|
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);
|
throw new RuntimeException("1-UserManager::getUser null exception:" + uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
initHeroMedal(user);
|
// initHeroMedal(user);
|
||||||
UserManager.addUser(user);
|
UserManager.addUser(user);
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initHeroMedal(User user) {
|
public static void initHeroMedal(User user) {
|
||||||
user.getHeroManager().getHeroMap().forEach((k, hero)-> {
|
user.getHeroManager().getHeroMap().forEach((k, hero)-> {
|
||||||
hero.getMedalPosToMap().forEach((pos, medalId) -> {
|
hero.getMedalPosToMap().forEach((pos, medalId) -> {
|
||||||
Medal medal = user.getMedalManager().getMedalMap().get(medalId);
|
Medal medal = user.getMedalManager().getMedalMap().get(medalId);
|
||||||
|
|
@ -379,7 +379,6 @@ public class UserManager {
|
||||||
public static User getUserOnlyInMap(int uid, boolean canNull) {
|
public static User getUserOnlyInMap(int uid, boolean canNull) {
|
||||||
User user = userMap.get(uid);
|
User user = userMap.get(uid);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
initHeroMedal(user);
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
return user;
|
return user;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue