计算世界等级bug

back_recharge
jiahuiwen 2021-10-30 15:01:52 +08:00
parent 29194289cc
commit 452462606d
2 changed files with 21 additions and 4 deletions

View File

@ -9,6 +9,8 @@ import com.ljsd.jieling.logic.dao.ServerConfig;
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
import com.ljsd.jieling.logic.dao.root.GuildInfo;
import com.mongodb.*;
import config.SMServerArenaSetting;
import manager.STableManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.mongodb.core.MongoTemplate;
@ -66,10 +68,16 @@ public class LjsdMongoTemplate implements MongoUpdateImp {
}
}
} else {
for (MongoTemplate mongoTemplate : MongoUtil.mongoTemplateMap.values()) {
MongoTemplate mongoTemplate = MongoUtil.mongoTemplateMap.get(GameApplication.serverId);
if (mongoTemplate != null) {
List<T> all = mongoTemplate.findAll(clazz);
list.addAll(all);
return all;
}
// for (MongoTemplate mongoTemplate : MongoUtil.mongoTemplateMap.values()) {
// List<T> all = mongoTemplate.findAll(clazz);
// list.addAll(all);
// }
}
return list;
//return mongoTemplate.findAll(clazz,collectionName);
@ -93,6 +101,14 @@ public class LjsdMongoTemplate implements MongoUpdateImp {
}
}
} else {
SMServerArenaSetting setting = STableManager.getConfig(SMServerArenaSetting.class).get(1);
int rankEndLine = setting.getWorldLevLimit();
if (query.getLimit() == rankEndLine) {
MongoTemplate mongoTemplate = MongoUtil.mongoTemplateMap.get(GameApplication.serverId);
List<T> all = mongoTemplate.find(query, entityClass);
list.addAll(all);
return list;
}
for (MongoTemplate mongoTemplate : MongoUtil.mongoTemplateMap.values()) {
List<T> all = mongoTemplate.find(query, entityClass);
list.addAll(all);

View File

@ -205,13 +205,14 @@ public class GlobleSystemLogic implements IEventHandler {
}
private static void setGlobalWorldLevelCache(int globalWorldLevelCache) {
if(globalWorldLevelCache>getGlobalWorldLevelCache()){
// TODO 下次更新前删除 强制设置一次世界等级
// if(globalWorldLevelCache>getGlobalWorldLevelCache()){
GLOABLE_WORLD_LEVE_CACHE = globalWorldLevelCache;
RedisUtil.getInstence().putMapEntry(RedisKey.SERVER_WORLDLEVE_INFO,"",String.valueOf(GameApplication.serverId),globalWorldLevelCache);
InnerMessageUtil.broadcastWithRandom(user->{
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(user.getId()), 1, MessageTypeProto.MessageType.WorldLevelIndication_VALUE, PlayerInfoProto.WorldLevelIndication.newBuilder().setWorldLeve(GlobleSystemLogic.getGlobalWorldLevelCache()).build(), true);
}, new LinkedList<>(OnlineUserManager.sessionMap.keySet()),10);
}
// }
}