fix 车迟工会排行没有获取到我的工会排行
parent
324b413a31
commit
501f5e9d70
|
@ -1,7 +1,9 @@
|
||||||
package com.ljsd.jieling.logic.rank.rankImpl;
|
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.protocols.CommonProto;
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||||
import org.springframework.data.redis.core.ZSetOperations;
|
import org.springframework.data.redis.core.ZSetOperations;
|
||||||
|
@ -13,36 +15,6 @@ public class CarDealyGuildRank extends AbstractRank{
|
||||||
super(type, redisKey);
|
super(type, redisKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected PlayerInfoProto.RankResponse.Builder getAllUserResponse(Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores, int start) throws Exception {
|
|
||||||
// PlayerInfoProto.RankResponse.Builder allUserResponse = super.getAllUserResponse(zsetreverseRangeWithScores, start);
|
|
||||||
// List<CommonProto.UserRank> ranksBuilderList = allUserResponse.getRanksList();
|
|
||||||
// if(ranksBuilderList.size()<2){
|
|
||||||
// return allUserResponse;
|
|
||||||
// }
|
|
||||||
// List<CommonProto.UserRank> builders = new ArrayList<>(ranksBuilderList);
|
|
||||||
// Collections.sort(builders,(o1, o2) -> {
|
|
||||||
// if(o1.getRankInfo().getParam1()==o2.getRankInfo().getParam1()){
|
|
||||||
// if(o1.getForce()>o2.getForce() &&o1.getRankInfo().getRank()>o2.getRankInfo().getRank()){
|
|
||||||
// CommonProto.UserRank rankInfo1 = o1 ;
|
|
||||||
// o1 = o2;
|
|
||||||
// o2 = rankInfo1;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return o1.getRankInfo().getRank()-o2.getRankInfo().getRank();
|
|
||||||
// });
|
|
||||||
// List<CommonProto.UserRank> buildersCopy = new ArrayList<>(ranksBuilderList.size());
|
|
||||||
// for(CommonProto.UserRank userRank : builders){
|
|
||||||
// buildersCopy.add(userRank.toBuilder().setRankInfo(userRank.toBuilder().getRankInfo().toBuilder().setRank(start).build()).build());
|
|
||||||
// start++;
|
|
||||||
// }
|
|
||||||
// PlayerInfoProto.RankResponse.Builder response = PlayerInfoProto.RankResponse.newBuilder();
|
|
||||||
// response.setMyRankInfo(allUserResponse.getMyRankInfo()).addAllRanks(buildersCopy);
|
|
||||||
// return response;
|
|
||||||
return super.getAllUserResponse(zsetreverseRangeWithScores,start);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getDataByScore(Double score) {
|
public int[] getDataByScore(Double score) {
|
||||||
return new int[]{(int) (score.longValue()/1000),(int) (score.longValue()%1000)};
|
return new int[]{(int) (score.longValue()/1000),(int) (score.longValue()%1000)};
|
||||||
|
@ -72,4 +44,17 @@ public class CarDealyGuildRank extends AbstractRank{
|
||||||
.build();
|
.build();
|
||||||
builder.addRanks(everyRank);
|
builder.addRanks(everyRank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void getMyInfo(User user, String rkey, PlayerInfoProto.RankResponse.Builder allUserResponse) {
|
||||||
|
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||||
|
int myRank= RedisUtil.getInstence().getZSetreverseRank(redisKey,rkey,Integer.toString(guildId)).intValue();
|
||||||
|
Double zSetScore = RedisUtil.getInstence().getZSetScore(redisKey, rkey, Integer.toString(guildId));
|
||||||
|
CommonProto.RankInfo towerRankInfo = CommonProto.RankInfo.newBuilder()
|
||||||
|
.setRank(myRank)
|
||||||
|
.setParam1(getParam1(zSetScore))
|
||||||
|
.setParam2(getParam2(zSetScore)).build();
|
||||||
|
allUserResponse.setMyRankInfo(towerRankInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue