跨服十绝阵优化

back_recharge
duhui 2021-07-28 16:25:38 +08:00
parent d51a4715e0
commit 0c9f09b13c
7 changed files with 27 additions and 11 deletions

View File

@ -1289,7 +1289,7 @@ public class RedisUtil {
}
public String getKey(String type,String key,boolean judge){
if (judge){
if (!judge){
return type + RedisKey.Delimiter_colon + key;
}

View File

@ -17,6 +17,6 @@ public class RankHandler extends BaseHandler<PlayerInfoProto.RankRequest> {
@Override
public void processWithProto(ISession iSession, PlayerInfoProto.RankRequest proto) throws Exception {
RankLogic.getInstance().getRank(iSession,proto.getType(),proto.getActiviteId(),
proto.getIndex(),MessageTypeProto.MessageType.GET_ONE_RANK_RESPONSE);
proto.getIndex(),proto.getIsCross(),MessageTypeProto.MessageType.GET_ONE_RANK_RESPONSE);
}
}

View File

@ -24,10 +24,10 @@ public enum RankEnum {
GUILD_RED_PACKAGE_RANK(13,RedisKey.GUILD_RED_PACKAGE_RANK,GuildRedPackageRank::new,false),//param1红包总价格 param2无 param3:无
CAR_DEALY_RANK(14,RedisKey.CAR_DEALY_RANK,CarDealyRank::new,false),//param1伤害 param2无 param3:无
CAR_DEALY_GUILD_RANK(19,RedisKey.CAR_DEALY_GUILD_RANK,CarDealyGuildRank::new,false),//param1伤害 param2无 param3:无
DEATH_PATH_EVERY_PERSON_RANK(15,RedisKey.DEATH_PATH_EVERY_PERSON_RANK,DeathPathEveryPersonRank::new,false),//param1当前阵玩家伤害 param2无 param3:无
DEATH_PATH_EVERY_GUILD_RANK(16,RedisKey.DEATH_PATH_EVERY_GUILD_RANK, DeathPathEveryGuildRank::new,false),//param1当前阵公会伤害 param2当前工会挑战人数 param3:无
DEATH_PATH_TOTAL_PERSON_RANK(17,RedisKey.DEATH_PATH_TOTAL_PERSON_RANK,DeathPathTotalPersonRank::new,false),//param1玩家总伤害 param2无 param3:无
DEATH_PATH_TOTAL_GUILD_RANK(18,RedisKey.DEATH_PATH_TOTAL_GUILD_RANK,DeathPathTotalGuildRank::new,false),//param1工会总伤害 param2无 param3:无
DEATH_PATH_EVERY_PERSON_RANK(15,RedisKey.DEATH_PATH_EVERY_PERSON_RANK,DeathPathEveryPersonRank::new,true),//param1当前阵玩家伤害 param2无 param3:无
DEATH_PATH_EVERY_GUILD_RANK(16,RedisKey.DEATH_PATH_EVERY_GUILD_RANK, DeathPathEveryGuildRank::new,true),//param1当前阵公会伤害 param2当前工会挑战人数 param3:无
DEATH_PATH_TOTAL_PERSON_RANK(17,RedisKey.DEATH_PATH_TOTAL_PERSON_RANK,DeathPathTotalPersonRank::new,true),//param1玩家总伤害 param2无 param3:无
DEATH_PATH_TOTAL_GUILD_RANK(18,RedisKey.DEATH_PATH_TOTAL_GUILD_RANK,DeathPathTotalGuildRank::new,true),//param1工会总伤害 param2无 param3:无
GUILD_FORCE_RANK(20,RedisKey.GUILD_FORCE_RANK,GuildForceRank::new,false),//param1公会总战力 param2无 param3:无
//达人排行榜
EXPERT_RANK(21,RedisKey.EXPERT_RANK,GoldRank::new,false),//param1活动进度 param2无 param3:无

View File

@ -66,20 +66,19 @@ public class RankLogic {
public static class Instance {
public final static RankLogic instance = new RankLogic();
}
public void getRank(ISession session, int type, int activityId,int index,MessageTypeProto.MessageType messageType) throws Exception {
public void getRank(ISession session, int type, int activityId,int index,int isCross,MessageTypeProto.MessageType messageType) throws Exception {
LOGGER.info("获取排行榜信息type={},activityId={}",type,activityId);
int page = 1;
String rkey = "";
if(activityId != 0){
rkey = String.valueOf(activityId);
}
PlayerInfoProto.RankResponse rankResponse=null;
AbstractRank rank = RankContext.getRankEnum(type);
if(RankContext.isCrossRank(type)){
if(RankContext.isCrossRank(type) || isCross == 1){
//跨服
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
if(crossGroup>0){
rankResponse = rank.getRank(session.getUid(),String.valueOf(crossGroup),index/20+1, 20);
rankResponse = rank.getCrossRank(session.getUid(),String.valueOf(crossGroup),index/20+1, 20);
}
}else{
rankResponse = rank.getRank(session.getUid(),rkey,index/20+1, 20);

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.rank.rankImpl;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.logic.GlobleSystemLogic;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.rank.IRank;
@ -36,7 +37,7 @@ public abstract class AbstractRank implements IRank {
* @return
* @throws Exception
*/
public PlayerInfoProto.RankResponse getRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
public PlayerInfoProto.RankResponse getRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
if(rankEndLine==-1){
rankEndLine = 100;
}
@ -55,6 +56,16 @@ public abstract class AbstractRank implements IRank {
return allUserResponse.build();
}
/**
*
* @throws Exception
*/
public PlayerInfoProto.RankResponse getCrossRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
int groupId = GlobleSystemLogic.getInstence().getCrossGroup();
redisKey = RedisUtil.getInstence().getKey(String.valueOf(groupId),redisKey,false);
return getRank(uid,rkey,page,rankEndLine);
}
/**
*
* @param uid id

View File

@ -105,4 +105,9 @@ public class CrossArenaRank extends AbstractRank {
e.printStackTrace();
}
}
@Override
public PlayerInfoProto.RankResponse getCrossRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
return getRank(uid,rkey,page,rankEndLine);
}
}

View File

@ -23,6 +23,7 @@ public class DeathPathEveryPersonRank extends AbstractRank {
return data[0];
}
@Override
public void addRank(int uid,String rkey,double... data){
RedisUtil.getInstence().incrementZsetScore(redisKey,rkey,String.valueOf(uid), Double.valueOf(getScore(data)).intValue());
}