跨服bug提交
parent
ea93c562cc
commit
d08086fe78
|
@ -256,9 +256,6 @@ public class GlobleSystemLogic implements IEventHandler {
|
|||
|
||||
index++;
|
||||
}
|
||||
// 跨服排行榜处理
|
||||
CrossRankManager.getInstance().cleanCrossRank();
|
||||
CrossRankManager.getInstance().crossRankHandle(true);
|
||||
|
||||
redisUtil.putMapEntrys(RedisKey.SERVER_SPLIT_INFO,"",split);
|
||||
//发分组邮件
|
||||
|
@ -269,6 +266,10 @@ public class GlobleSystemLogic implements IEventHandler {
|
|||
redisUtil.del(RedisKey.CHAT_CROSS_MSG_ID+i);
|
||||
}
|
||||
|
||||
// 跨服排行榜处理
|
||||
CrossRankManager.getInstance().cleanCrossRank();
|
||||
CrossRankManager.getInstance().crossRankHandle(true);
|
||||
|
||||
//释放分布式锁
|
||||
redisUtil.del("SERVER_SPLIT_REDIS_LOCK");
|
||||
|
||||
|
|
|
@ -52,30 +52,27 @@ public class CrossRankManager {
|
|||
// 全部排行遍历
|
||||
for (RankEnum value : RankEnum.values()) {
|
||||
int type = value.getType();
|
||||
boolean rank2 = RankContext.isCrossRank2(type);
|
||||
if (rank2){
|
||||
//跨服
|
||||
if(RankContext.isCrossRank(type)){
|
||||
// 获取分组id,是否跨服
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if(crossGroup != -1){
|
||||
AbstractRank rank = RankContext.getRankEnum(type);
|
||||
String key = RedisUtil.getInstence().getKey(rank.getCrossRedisKey(),"",false);
|
||||
Map<Integer, GuildCache> cacheMap = RedisUtil.getInstence().getMapValues(RedisKey.FAMILY_INFO, "", Integer.class, GuildCache.class);
|
||||
Set<ZSetOperations.TypedTuple<String>> range = RedisUtil.getInstence().getZsetreverseRangeWithScores(rank.getRedisKey(), "", 0, 100, true);
|
||||
for (ZSetOperations.TypedTuple<String> tuple : range) {
|
||||
if (tuple.getValue().length() == 8){
|
||||
rank.crossUserCache(Integer.parseInt(tuple.getValue()));
|
||||
}else {
|
||||
GuildCache cache = cacheMap.get(Integer.valueOf(tuple.getValue()));
|
||||
if (cache != null && cache.getLeaderUId() != 0){
|
||||
rank.crossUserCache(cache.getLeaderUId());
|
||||
}
|
||||
//跨服
|
||||
if(RankContext.isCrossRank2(type) && RankContext.isCrossRank(type)){
|
||||
// 获取分组id,是否跨服
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if(crossGroup != -1){
|
||||
AbstractRank rank = RankContext.getRankEnum(type);
|
||||
String key = RedisUtil.getInstence().getKey(rank.getCrossRedisKey(),"",false);
|
||||
Map<Integer, GuildCache> cacheMap = RedisUtil.getInstence().getMapValues(RedisKey.FAMILY_INFO, "", Integer.class, GuildCache.class);
|
||||
Set<ZSetOperations.TypedTuple<String>> range = RedisUtil.getInstence().getZsetreverseRangeWithScores(rank.getRedisKey(), "", 0, 100, true);
|
||||
for (ZSetOperations.TypedTuple<String> tuple : range) {
|
||||
if (tuple.getValue().length() == 8){
|
||||
rank.crossUserCache(Integer.parseInt(tuple.getValue()));
|
||||
}else {
|
||||
GuildCache cache = cacheMap.get(Integer.valueOf(tuple.getValue()));
|
||||
if (cache != null && cache.getLeaderUId() != 0){
|
||||
rank.crossUserCache(cache.getLeaderUId());
|
||||
}
|
||||
RedisUtil.getInstence().zsetAddOne(key,tuple.getValue(),tuple.getScore());
|
||||
}
|
||||
LOGGER.info("=====================跨服排行榜处理========,key:{}",key);
|
||||
RedisUtil.getInstence().zsetAddOne(key,tuple.getValue(),tuple.getScore());
|
||||
}
|
||||
LOGGER.info("=====================跨服排行榜处理========,key:{}",key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,17 +113,15 @@ public class CrossRankManager {
|
|||
public void cleanCrossRank(){
|
||||
for (RankEnum value : RankEnum.values()) {
|
||||
int type = value.getType();
|
||||
if (RankContext.isCrossRank2(type)) {
|
||||
//跨服
|
||||
if (RankContext.isCrossRank(type)) {
|
||||
// 获取分组id,是否跨服
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if (crossGroup != -1) {
|
||||
AbstractRank rank = RankContext.getRankEnum(type);
|
||||
String key = RedisUtil.getInstence().getKey(rank.getCrossRedisKey(),"",false);
|
||||
RedisUtil.getInstence().del(key);
|
||||
LOGGER.info("=====================跨服排行榜清理========,key:{}", key);
|
||||
}
|
||||
//跨服
|
||||
if (RankContext.isCrossRank2(type) && RankContext.isCrossRank(type)) {
|
||||
// 获取分组id,是否跨服
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if (crossGroup != -1) {
|
||||
AbstractRank rank = RankContext.getRankEnum(type);
|
||||
String key = RedisUtil.getInstence().getKey(rank.getCrossRedisKey(),"",false);
|
||||
RedisUtil.getInstence().del(key);
|
||||
LOGGER.info("=====================跨服排行榜清理========,key:{}", key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.ljsd.jieling.db.redis.RedisUtil;
|
|||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.dao.CrossArenaEnemy;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.gm.ArenaOfUser;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import config.SArenaRobotConfig;
|
||||
|
@ -13,6 +14,7 @@ import rpc.protocols.CommonProto;
|
|||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
|
@ -88,9 +90,10 @@ public class CrossArenaRank extends AbstractRank {
|
|||
.setServerName(query.getPlayerManager().getServerName())
|
||||
.setSex(0);
|
||||
builder.addRanks(everyRank);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getMyInfo(User user, String rkey, PlayerInfoProto.RankResponse.Builder allUserResponse){
|
||||
int myRank= RedisUtil.getInstence().getZSetreverseRank(redisKey,rkey,Integer.toString(user.getId())).intValue();
|
||||
Double zSetScore = RedisUtil.getInstence().getZSetScore(redisKey, rkey, Integer.toString(user.getId()));
|
||||
|
@ -108,7 +111,23 @@ public class CrossArenaRank extends AbstractRank {
|
|||
|
||||
@Override
|
||||
public PlayerInfoProto.RankResponse getCrossRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
|
||||
rkey = Integer.toString(GlobleSystemLogic.getInstence().getCrossGroup());
|
||||
return getRank(uid,rkey,page,rankEndLine);
|
||||
if(rankEndLine==-1){
|
||||
rankEndLine = 100;
|
||||
}
|
||||
User user = UserManager.getUser(uid);
|
||||
if (page == 0) {
|
||||
page = 1;
|
||||
}
|
||||
int start = (page - 1) * rankEndLine, end = page * rankEndLine - 1;
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
Set<ZSetOperations.TypedTuple<String>> scores =
|
||||
RedisUtil.getInstence().getZsetreverseRangeWithScores(redisKey, String.valueOf(crossGroup), start, end, false);
|
||||
if(start % rankEndLine == 0){
|
||||
start++;
|
||||
}
|
||||
PlayerInfoProto.RankResponse.Builder allUserResponse = getCrossAllUserResponse(scores,start);
|
||||
//当前用户信息
|
||||
getCrossMyInfo(user,rkey,allUserResponse);
|
||||
return allUserResponse.build();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue