master_ob2
PC-202302260912\Administrator 2023-11-28 10:13:08 +08:00
parent da11935589
commit e2e510dd65
3 changed files with 15 additions and 16 deletions

View File

@ -1,4 +1,4 @@
{
"version":"5",
"tables":""
"version":"6",
"tables":"GlobalActivity"
}

View File

@ -1,5 +1,6 @@
{
"version":"5",
"version":"6",
"classes":[
{"name":"GetWorldArenaRecordInfoRequestHandler.class","fullName":"com.ljsd.jieling.handler.gtw.GetWorldArenaRecordInfoRequestHandler"}
]
}

View File

@ -34,7 +34,7 @@ public class GetWorldArenaRecordInfoRequestHandler extends BaseHandler<WorldProt
@Override
public void processWithProto(ISession iSession, WorldProto.GetWorldArenaRecordInfoRequest proto) throws Exception {
// LOGGER.info("进入罗浮战斗记录协议");
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.World_Arena.getFunctionType());
if (!GlobleSystemLogic.checkOpen(UserManager.getUser(iSession.getUid()),sGlobalSystemConfig)) {
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
@ -49,8 +49,8 @@ public class GetWorldArenaRecordInfoRequestHandler extends BaseHandler<WorldProt
// return builder.build();
// }
Map<String, byte[]> result = RedisUtil.getInstence().getMapValues(RedisKey.WORLD_ARENA_RRECORD, Integer.toString(iSession.getUid()), String.class, byte[].class);
if (result != null && !result.isEmpty()) {
// LOGGER.info("罗浮战斗记录个人数量uid{}num{}",iSession.getUid(), result.values().size());
List< byte[]> arenaRecordList = new ArrayList<>(result.values());
List<WorldProto.WroldBattleRecord> collect = arenaRecordList.stream().map(bytes -> {
try {
@ -64,27 +64,25 @@ public class GetWorldArenaRecordInfoRequestHandler extends BaseHandler<WorldProt
}).sorted(Comparator.comparingInt(wroldBattleRecord1 -> wroldBattleRecord1 != null ? wroldBattleRecord1.getAttackTime() : 0)).collect(Collectors.toList());
Collections.reverse(collect);
int size = arenaRecordList.size();
// LOGGER.info("罗浮战斗记录个人数量2uid{}num{}",iSession.getUid(), size);
if (size > 15) {
String[] removeMapKeys = new String[size - 15];
// String[] removeMapKeys = new String[size - 15];
ArrayList<String> list = new ArrayList<>(size - 15);
// LOGGER.info("罗浮战斗记录删除数组长度uid{}num{}",iSession.getUid(), size - 15);
for (int i = 0; i < size - 15; i++) {
WorldProto.WroldBattleRecord remove = collect.remove(size-i-1);
String removeId = remove.getRecordId();
removeMapKeys[i] = (removeId);
// removeMapKeys[i] = remove.getRecordId();
list.add(remove.getRecordId());
}
RedisUtil.getInstence().removeMapEntrys(RedisKey.WORLD_ARENA_RRECORD, Integer.toString(iSession.getUid()), (Object) removeMapKeys);
RedisUtil.getInstence().removeMapEntrys(RedisKey.WORLD_ARENA_RRECORD, Integer.toString(iSession.getUid()), list.toArray());
// LOGGER.info("罗浮战斗记录删除数组uid{}num{}, num2:{}",iSession.getUid(), removeMapKeys, collect.size());
}
builder.addAllWroldBattleRecord(collect);
}
// LOGGER.info("罗浮战斗记录结果uid{}num{}",iSession.getUid(), RedisUtil.getInstence().getMapValues(RedisKey.WORLD_ARENA_RRECORD, Integer.toString(iSession.getUid()), String.class, byte[].class).size());
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.GetWorldArenaRecordInfoResponse.getNumber(),builder.build(),true);
// //转发到world服
// boolean b = WorldHelper.sendMessageToWord(iSession.getUid(),proto);
// if(!b){
// throw new ErrorCodeException(ErrorCode.UNKNOWN);
// }
}
}