跨服十绝阵

duhui 2021-09-02 13:49:36 +08:00
parent 6f02df1ee8
commit 607a2b569a
16 changed files with 86 additions and 44 deletions

View File

@ -200,6 +200,9 @@ public class RedisKey {
public static final String DEATH_PATH_EVERY_OVER_HASH = "DEATH_PATH_EVERY_OVER_HASH";//结算标识 public static final String DEATH_PATH_EVERY_OVER_HASH = "DEATH_PATH_EVERY_OVER_HASH";//结算标识
// 死亡之旅挑战第一名推送
public static final String DEATH_PATH_CHALLENGE_FIRST_PUSH = "DEATH_PATH_CHALLENGE_FIRST_PUSH";
//问卷调查 //问卷调查
public static final String QUESTION_FROMBACK = "QUESTION_FROMBACK"; public static final String QUESTION_FROMBACK = "QUESTION_FROMBACK";

View File

@ -295,7 +295,7 @@ public class RedisUtil {
//connection.getSet返回这个key的旧值并设置新值。 //connection.getSet返回这个key的旧值并设置新值。
byte[] oldValue = connection.getSet(lockKey.getBytes(), String.valueOf(nowTime + lockExpireMils + 1).getBytes()); byte[] oldValue = connection.getSet(lockKey.getBytes(), String.valueOf(nowTime + lockExpireMils + 1).getBytes());
//当key不存时会返回空表示key不存在或者已在管道中使用 //当key不存时会返回空表示key不存在或者已在管道中使用
return oldValue == null ? false : Long.parseLong(new String(oldValue)) < nowTime; return oldValue != null && Long.parseLong(new String(oldValue)) < nowTime;
} }
} }
} }
@ -1220,8 +1220,9 @@ public class RedisUtil {
for (int i = 0; i < MAX_TRY_TIMES; i++) { for (int i = 0; i < MAX_TRY_TIMES; i++) {
try { try {
String valueStr = (String) redisTemplate.opsForHash().get(rkey, mapKey); String valueStr = (String) redisTemplate.opsForHash().get(rkey, mapKey);
if (valueStr != null) if (valueStr != null) {
return gson.fromJson(valueStr, clazz); return gson.fromJson(valueStr, clazz);
}
} catch (Exception e) { } catch (Exception e) {
TimeUtils.sleep(FAILED_SLEEP); TimeUtils.sleep(FAILED_SLEEP);
} }

View File

@ -14,6 +14,7 @@ import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.GuildCache; import com.ljsd.jieling.logic.dao.root.GuildCache;
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.logic.dao.root.User;
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
import com.ljsd.jieling.logic.family.GuildLogic; import com.ljsd.jieling.logic.family.GuildLogic;
import com.ljsd.jieling.logic.mission.GameEvent; import com.ljsd.jieling.logic.mission.GameEvent;
import rpc.protocols.CommonProto; import rpc.protocols.CommonProto;
@ -95,7 +96,7 @@ public class FamilyFeteRequestHandler extends BaseHandler<Family.FamilyFeteReque
if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + addexp >= levelConfigMap.get(guildInfo.getLevel()).getExp()) { if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + addexp >= levelConfigMap.get(guildInfo.getLevel()).getExp()) {
guildInfo.updateExp(guildInfo.getExp() + addexp - levelConfigMap.get(guildInfo.getLevel()).getExp()); guildInfo.updateExp(guildInfo.getExp() + addexp - levelConfigMap.get(guildInfo.getLevel()).getExp());
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1); GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), GuildCache.create(guildInfo)); CrossDeathPathLogic.setCrossGuild(guildInfo);
} else { } else {
guildInfo.updateExp(guildInfo.getExp() + addexp); guildInfo.updateExp(guildInfo.getExp() + addexp);
} }

View File

@ -7,6 +7,7 @@ import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.logic.dao.GuilidManager; import com.ljsd.jieling.logic.dao.GuilidManager;
import com.ljsd.jieling.logic.dao.root.GuildCache; import com.ljsd.jieling.logic.dao.root.GuildCache;
import com.ljsd.jieling.logic.dao.root.GuildInfo; import com.ljsd.jieling.logic.dao.root.GuildInfo;
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
import com.ljsd.jieling.logic.family.GuildLogic; import com.ljsd.jieling.logic.family.GuildLogic;
import config.SGuildLevelConfig; import config.SGuildLevelConfig;
import manager.STableManager; import manager.STableManager;
@ -35,7 +36,7 @@ public class Cmd_addfete extends GmRoleAbstract {
if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + addexp >= levelConfigMap.get(guildInfo.getLevel()).getExp()) { if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + addexp >= levelConfigMap.get(guildInfo.getLevel()).getExp()) {
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1); GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
guildInfo.updateExp(guildInfo.getExp() + addexp - levelConfigMap.get(guildInfo.getLevel()).getExp()); guildInfo.updateExp(guildInfo.getExp() + addexp - levelConfigMap.get(guildInfo.getLevel()).getExp());
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), GuildCache.create(guildInfo)); CrossDeathPathLogic.setCrossGuild(guildInfo);
} else { } else {
guildInfo.updateExp(guildInfo.getExp() + addexp); guildInfo.updateExp(guildInfo.getExp() + addexp);
} }

View File

@ -138,7 +138,7 @@ public class CrossServiceLogic {
arenaOfPlayerManager.setName(player.getNickName()); arenaOfPlayerManager.setName(player.getNickName());
arenaOfPlayerManager.setHead(player.getHead()); arenaOfPlayerManager.setHead(player.getHead());
arenaOfPlayerManager.setHeadFrame(player.getHeadFrame()); arenaOfPlayerManager.setHeadFrame(player.getHeadFrame());
GuildCache mapEntry = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildId), GuildCache.class); GuildCache mapEntry = CrossDeathPathLogic.getCrossGuild(guildId);
arenaOfPlayerManager.setGuildId(guildId); arenaOfPlayerManager.setGuildId(guildId);
arenaOfPlayerManager.setGuildName(mapEntry==null?"":mapEntry.getName()); arenaOfPlayerManager.setGuildName(mapEntry==null?"":mapEntry.getName());

View File

@ -6,6 +6,8 @@ import com.ljsd.jieling.db.mongo.core.CServerInfo;
import com.ljsd.jieling.db.redis.RedisKey; import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil; import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.logic.dao.GuildInfoCache; import com.ljsd.jieling.logic.dao.GuildInfoCache;
import com.ljsd.jieling.logic.dao.root.GuildCache;
import com.ljsd.jieling.logic.dao.root.GuildInfo;
import com.ljsd.jieling.logic.rank.RankContext; import com.ljsd.jieling.logic.rank.RankContext;
import com.ljsd.jieling.logic.rank.RankEnum; import com.ljsd.jieling.logic.rank.RankEnum;
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank; import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
@ -15,6 +17,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.redis.core.Cursor; import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.ZSetOperations; import org.springframework.data.redis.core.ZSetOperations;
import util.StringUtil;
import util.TimeUtils; import util.TimeUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -108,7 +111,7 @@ public class CrossDeathPathLogic {
redisUtil.incrementZsetScore(totalGuild.getCrossRedisKey(),"",before, -1,false); redisUtil.incrementZsetScore(totalGuild.getCrossRedisKey(),"",before, -1,false);
} }
// 推送 // 推送
DeathPathLogic.getInstance().sendChangeIndication(guildId,pathId); DeathPathLogic.getInstance().sendChangeIndicationCross(guildId,pathId);
} }
AbstractRank totalPerson = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_PERSON_RANK.getType()); AbstractRank totalPerson = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_PERSON_RANK.getType());
// 个人单个排行 // 个人单个排行
@ -126,13 +129,31 @@ public class CrossDeathPathLogic {
* @param id * @param id
* @return * @return
*/ */
public static GuildInfoCache getCrossGuild(int id){ public static GuildCache getCrossGuild(int id){
GuildInfoCache crossGuild = crossGuildMap.get(id); return RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(id), GuildCache.class);
if(crossGuild==null){ }
crossGuild = RedisUtil.getInstence().getMapEntry(RedisKey.GUILD_INFO_CACHE, "", String.valueOf(id), GuildInfoCache.class);
crossGuildMap.put(id,crossGuild); /**
*
* @param guildInfo
* @return
*/
public static void setCrossGuild(GuildInfo guildInfo){
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), GuildCache.create(guildInfo));
}
/**
*
*/
public void sendChangeIndicationByCross(){
Map<Object, Object> map = RedisUtil.getInstence().hmget(RedisKey.DEATH_PATH_CHALLENGE_FIRST_PUSH);
if (map != null && !map.isEmpty()){
for (Map.Entry<Object, Object> entry : map.entrySet()) {
int guildId = (int) entry.getValue();
int pathId = (int) entry.getKey();
DeathPathLogic.getInstance().sendChangeIndication(guildId,pathId);
}
} }
return crossGuild;
} }
/** /**
@ -173,7 +194,7 @@ public class CrossDeathPathLogic {
for(ZSetOperations.TypedTuple<String> value:values){ for(ZSetOperations.TypedTuple<String> value:values){
rank++; rank++;
int guildId = Integer.valueOf(value.getValue()); int guildId = Integer.valueOf(value.getValue());
GuildInfoCache guild = getCrossGuild(guildId); GuildCache guild = getCrossGuild(guildId);
if(guild==null||guild.getServerId()!=serverId){ if(guild==null||guild.getServerId()!=serverId){
continue; continue;
} }

View File

@ -16,6 +16,7 @@ import com.ljsd.jieling.logic.GlobalDataManaager;
import com.ljsd.jieling.logic.GlobleSystemLogic; import com.ljsd.jieling.logic.GlobleSystemLogic;
import com.ljsd.jieling.logic.OnlineUserManager; import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.dao.*; import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.GuildCache;
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.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.*; import com.ljsd.jieling.logic.fight.*;
@ -331,10 +332,10 @@ public class DeathPathLogic {
} }
ZSetOperations.TypedTuple<String> next = iterator.next(); ZSetOperations.TypedTuple<String> next = iterator.next();
int guildId = Integer.parseInt(next.getValue()); int guildId = Integer.parseInt(next.getValue());
GuildInfoCache crossGuild = CrossDeathPathLogic.getCrossGuild(guildId); GuildCache crossGuild = CrossDeathPathLogic.getCrossGuild(guildId);
Integer serverId = Optional.ofNullable(CrossDeathPathLogic.getCrossGuild(guildId)).map(GuildInfoCache::getServerId).orElse(0); Integer serverId = Optional.ofNullable(CrossDeathPathLogic.getCrossGuild(guildId)).map(GuildCache::getServerId).orElse(0);
String serverName = result?CrossDeathPathLogic.getInstance().getServerNameByDeathPath(serverId):""; String serverName = result?CrossDeathPathLogic.getInstance().getServerNameByDeathPath(serverId):"";
Family.DeathPathInfo info = Family.DeathPathInfo.newBuilder().setGuildName(crossGuild.getGuildName()).setPathId(i).setGid(guildId).setServerName(serverName).build(); Family.DeathPathInfo info = Family.DeathPathInfo.newBuilder().setGuildName(crossGuild.getName()).setPathId(i).setGid(guildId).setServerName(serverName).build();
response.addInfos(info); response.addInfos(info);
} }
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true); MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
@ -501,16 +502,17 @@ public class DeathPathLogic {
public void sendChangeIndication(int currFirstGuildId,int pathId){ public void sendChangeIndication(int currFirstGuildId,int pathId){
AbstractRank guildTotalRank = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_GUILD_RANK.getType()); AbstractRank guildTotalRank = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_GUILD_RANK.getType());
Set<ZSetOperations.TypedTuple<String>> allGuild = guildTotalRank.getRankByKey("", 0, -1); Set<ZSetOperations.TypedTuple<String>> allGuild;
String name = GuilidManager.guildInfoMap.get(currFirstGuildId).getName(); if (getGroupId() > 0){
allGuild = guildTotalRank.getCrossRankByKey("", 0, -1);
}else {
allGuild = guildTotalRank.getRankByKey("", 0, -1);
}
for (ZSetOperations.TypedTuple<String> n : allGuild) { for (ZSetOperations.TypedTuple<String> n : allGuild) {
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(n.getValue())); GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(n.getValue()));
Family.DeathPathInfo info = Family.DeathPathInfo.newBuilder().setGuildName(name).setGid(currFirstGuildId).setPathId(pathId).build();
Family.DeathPathFirstChangeIndication indication = Family.DeathPathFirstChangeIndication.newBuilder().setChangeInfo(info).build();
if(guildInfo!=null){ if(guildInfo!=null){
Family.DeathPathInfo info = Family.DeathPathInfo.newBuilder().setGuildName(guildInfo.getName()).setGid(currFirstGuildId).setPathId(pathId).build();
Family.DeathPathFirstChangeIndication indication = Family.DeathPathFirstChangeIndication.newBuilder().setChangeInfo(info).build();
GuildLogic.sendIndicationToMember(guildInfo, MessageTypeProto.MessageType.DEATH_PATH_FIRST_CHANGE_INDICATION,indication); GuildLogic.sendIndicationToMember(guildInfo, MessageTypeProto.MessageType.DEATH_PATH_FIRST_CHANGE_INDICATION,indication);
}else{ }else{
LOGGER.error("Exception公会信息为空不能发送推送公会id为{}",n.getValue()); LOGGER.error("Exception公会信息为空不能发送推送公会id为{}",n.getValue());
@ -519,6 +521,12 @@ public class DeathPathLogic {
LOGGER.info("信息修改,需要推送"); LOGGER.info("信息修改,需要推送");
} }
public void sendChangeIndicationCross(int pathId,int guildId){
if (getGroupId() > 0){
RedisUtil.getInstence().hset(RedisKey.DEATH_PATH_CHALLENGE_FIRST_PUSH,String.valueOf(pathId),guildId,60000);
}
}
/** /**
* *
* @param session * @param session

View File

@ -223,7 +223,7 @@ public class GuildChallengeLogic {
if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + config.getLegionExp() >= levelConfigMap.get(guildInfo.getLevel()).getExp()) { if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + config.getLegionExp() >= levelConfigMap.get(guildInfo.getLevel()).getExp()) {
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp() - levelConfigMap.get(guildInfo.getLevel()).getExp()); guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp() - levelConfigMap.get(guildInfo.getLevel()).getExp());
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1); GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), GuildCache.create(guildInfo)); CrossDeathPathLogic.setCrossGuild(guildInfo);
} else { } else {
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp()); guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp());
} }
@ -254,7 +254,7 @@ public class GuildChallengeLogic {
if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + config.getLegionExp() >= levelConfigMap.get(guildInfo.getLevel()).getExp()) { if (GuildLogic.checkGuildLevelMax(guildInfo)&&guildInfo.getExp() + config.getLegionExp() >= levelConfigMap.get(guildInfo.getLevel()).getExp()) {
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp() - levelConfigMap.get(guildInfo.getLevel()).getExp()); guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp() - levelConfigMap.get(guildInfo.getLevel()).getExp());
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1); GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), GuildCache.create(guildInfo)); CrossDeathPathLogic.setCrossGuild(guildInfo);
} else { } else {
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp()); guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp());
} }

View File

@ -201,13 +201,9 @@ public class GuildFightLogic {
} }
private static Family.FamilyFightInfo familyFightDetailInfo(int guildId) throws Exception { private static Family.FamilyFightInfo familyFightDetailInfo(int guildId){
RedisUtil redisUtil = RedisUtil.getInstence(); RedisUtil redisUtil = RedisUtil.getInstence();
Map<String, int[]> buffCache = redisUtil.getMapValues(RedisKey.FAMILY_FIGHT_BUFF, String.valueOf(guildId), String.class, int[].class); Map<String, int[]> buffCache = redisUtil.getMapValues(RedisKey.FAMILY_FIGHT_BUFF, String.valueOf(guildId), String.class, int[].class);
// GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
// Map<Integer, Integer> defendInfo = guildInfo.getDefendInfo();
GuildCache mapEntry = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildId), GuildCache.class);
// RedisUtil.getInstence().getMapValues(RedisKey.FAMILY_FIGHT,String.valueOf(guildId),Integer.class,FamilyFightInfo.class)
Map<Integer, FamilyFightInfo> fightValues = RedisUtil.getInstence().getMapValues(RedisKey.FAMILY_FIGHT, String.valueOf(guildId), Integer.class, FamilyFightInfo.class); Map<Integer, FamilyFightInfo> fightValues = RedisUtil.getInstence().getMapValues(RedisKey.FAMILY_FIGHT, String.valueOf(guildId), Integer.class, FamilyFightInfo.class);
Family.FamilyFightInfo.Builder fightInfo = Family.FamilyFightInfo.newBuilder(); Family.FamilyFightInfo.Builder fightInfo = Family.FamilyFightInfo.newBuilder();
fightInfo.setGid(guildId); fightInfo.setGid(guildId);
@ -387,8 +383,7 @@ public class GuildFightLogic {
continue; continue;
} }
GuildInfo guildInfo = entry.getValue(); GuildInfo guildInfo = entry.getValue();
GuildCache enemyInfo = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(enemyFamily), GuildCache.class); GuildCache enemyInfo = CrossDeathPathLogic.getCrossGuild(enemyFamily);
// GuildInfo enemyInfo = GuilidManager.guildInfoMap.get(enemyFamily);
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder().setId(enemyFamily) Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder().setId(enemyFamily)
.setLevel(enemyInfo.getLevel()) .setLevel(enemyInfo.getLevel())
.setName(Optional.ofNullable(enemyInfo).map(GuildCache::getName).orElse("")) .setName(Optional.ofNullable(enemyInfo).map(GuildCache::getName).orElse(""))
@ -562,12 +557,12 @@ public class GuildFightLogic {
response.setJoinType(1); response.setJoinType(1);
} }
if (enemyFamily != -1) { if (enemyFamily != -1) {
GuildCache enemyInfo = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(enemyFamily), GuildCache.class); GuildCache enemyInfo = CrossDeathPathLogic.getCrossGuild(enemyFamily);
if(enemyInfo!=null){ if(enemyInfo!=null){
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder() Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder()
.setId(enemyFamily) .setId(enemyFamily)
.setLevel(enemyInfo.getLevel()) .setLevel(enemyInfo.getLevel())
.setName(Optional.ofNullable(enemyInfo).map(GuildCache::getName).orElse("")) .setName(Optional.of(enemyInfo).map(GuildCache::getName).orElse(""))
.setPictureId(enemyInfo.getIcon()) .setPictureId(enemyInfo.getIcon())
.setTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(enemyFamily),Integer.class)) .setTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(enemyFamily),Integer.class))
.setMyTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(guildId),Integer.class)) .setMyTotalStar(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",String.valueOf(guildId),Integer.class))
@ -819,7 +814,7 @@ public class GuildFightLogic {
if(guildInfo.getExp()+getExp>=levelConfigMap.get(guildInfo.getLevel()).getExp()){ if(guildInfo.getExp()+getExp>=levelConfigMap.get(guildInfo.getLevel()).getExp()){
guildInfo.updateExp(guildInfo.getExp()+getExp-levelConfigMap.get(guildInfo.getLevel()).getExp()); guildInfo.updateExp(guildInfo.getExp()+getExp-levelConfigMap.get(guildInfo.getLevel()).getExp());
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1); GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"", String.valueOf(guildInfo.getId()),GuildCache.create(guildInfo)); CrossDeathPathLogic.setCrossGuild(guildInfo);
}else{ }else{
guildInfo.updateExp(guildInfo.getExp()+getExp); guildInfo.updateExp(guildInfo.getExp()+getExp);
} }

View File

@ -191,7 +191,7 @@ public class GuildLogic {
GuilidManager.addGuildInfo(guildInfo); GuilidManager.addGuildInfo(guildInfo);
user.getPlayerInfoManager().setGuildId(guildInfo.getId()); user.getPlayerInfoManager().setGuildId(guildInfo.getId());
addGuildLog(guildInfo.getId(),GuildDef.Log.CREATE,user.getPlayerInfoManager().getNickName()); addGuildLog(guildInfo.getId(),GuildDef.Log.CREATE,user.getPlayerInfoManager().getNickName());
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"",String.valueOf(guildInfo.getId()),GuildCache.create(guildInfo)); CrossDeathPathLogic.setCrossGuild(guildInfo);
PlayerInfoCache cache = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(uid), PlayerInfoCache.class); PlayerInfoCache cache = RedisUtil.getInstence().getMapEntry(RedisKey.PLAYER_INFO_CACHE, "", String.valueOf(uid), PlayerInfoCache.class);
cache.setGuildPosition(GlobalsDef.CHAIRMAN); cache.setGuildPosition(GlobalsDef.CHAIRMAN);
@ -844,7 +844,7 @@ public class GuildLogic {
} }
guildInfo.setName(content); guildInfo.setName(content);
// 缓存同步 // 缓存同步
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"",String.valueOf(guildInfo.getId()),GuildCache.create(guildInfo)); CrossDeathPathLogic.setCrossGuild(guildInfo);
} }
MessageUtil.sendMessage(session,resultCode,msgId,response,true); MessageUtil.sendMessage(session,resultCode,msgId,response,true);
} }
@ -1158,7 +1158,7 @@ public class GuildLogic {
} }
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId()); GuildInfo guildInfo = GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId());
guildInfo.updateIcon(iconId); guildInfo.updateIcon(iconId);
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"", String.valueOf(playerInfoManager.getGuildId()),GuildCache.create(guildInfo)); CrossDeathPathLogic.setCrossGuild(guildInfo);
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true); MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
} }

View File

@ -6,6 +6,7 @@ import com.ljsd.jieling.logic.GlobleSystemLogic;
import com.ljsd.jieling.logic.dao.GuilidManager; import com.ljsd.jieling.logic.dao.GuilidManager;
import com.ljsd.jieling.logic.dao.root.GuildCache; import com.ljsd.jieling.logic.dao.root.GuildCache;
import com.ljsd.jieling.logic.dao.root.GuildInfo; import com.ljsd.jieling.logic.dao.root.GuildInfo;
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank; import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -100,7 +101,7 @@ public class CrossRankManager {
public void guildCacheHandle(){ public void guildCacheHandle(){
Map<Integer, GuildInfo> guildInfoMap = GuilidManager.guildInfoMap; Map<Integer, GuildInfo> guildInfoMap = GuilidManager.guildInfoMap;
for (Map.Entry<Integer, GuildInfo> entry : guildInfoMap.entrySet()) { for (Map.Entry<Integer, GuildInfo> entry : guildInfoMap.entrySet()) {
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"", String.valueOf(entry.getValue().getId()), GuildCache.create(entry.getValue())); CrossDeathPathLogic.setCrossGuild(entry.getValue());
} }
LOGGER.info("==================工会缓存处理============="); LOGGER.info("==================工会缓存处理=============");
} }

View File

@ -8,6 +8,7 @@ import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.gm.ArenaOfUser; import com.ljsd.jieling.logic.dao.gm.ArenaOfUser;
import com.ljsd.jieling.logic.dao.root.GuildCache; import com.ljsd.jieling.logic.dao.root.GuildCache;
import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
import com.ljsd.jieling.logic.rank.IRank; import com.ljsd.jieling.logic.rank.IRank;
import org.springframework.data.redis.core.Cursor; import org.springframework.data.redis.core.Cursor;
import rpc.protocols.CommonProto; import rpc.protocols.CommonProto;
@ -151,6 +152,10 @@ public abstract class AbstractRank implements IRank {
return RedisUtil.getInstence().getZsetreverseRangeWithScores(redisKey, rkey, start, end); return RedisUtil.getInstence().getZsetreverseRangeWithScores(redisKey, rkey, start, end);
} }
public Set<ZSetOperations.TypedTuple<String>> getCrossRankByKey(String rkey,int start,int end){
return RedisUtil.getInstence().getZsetreverseRangeWithScores(getCrossRedisKey(), rkey, start, end, false);
}
//获取第一名信息 //获取第一名信息
public CommonProto.UserRank.Builder getFirst(int activityId) throws Exception { public CommonProto.UserRank.Builder getFirst(int activityId) throws Exception {
Set<ZSetOperations.TypedTuple<String>> rankByKey = getRankByKey(activityId==0?"":String.valueOf(activityId), 0, 0); Set<ZSetOperations.TypedTuple<String>> rankByKey = getRankByKey(activityId==0?"":String.valueOf(activityId), 0, 0);
@ -269,6 +274,7 @@ public abstract class AbstractRank implements IRank {
public CommonProto.UserRank.Builder getCrossOneUserRank(ArenaOfUser query, CommonProto.RankInfo.Builder everyRankInfo){ public CommonProto.UserRank.Builder getCrossOneUserRank(ArenaOfUser query, CommonProto.RankInfo.Builder everyRankInfo){
String serverName = CrossServiceLogic.getInstance().getServerNameByUId(query.getId()); String serverName = CrossServiceLogic.getInstance().getServerNameByUId(query.getId());
GuildCache mapEntry = CrossDeathPathLogic.getCrossGuild(query.getPlayerManager().getGuildId());
return CommonProto.UserRank.newBuilder() return CommonProto.UserRank.newBuilder()
.setUid(query.getId()) .setUid(query.getId())
.setLevel(query.getPlayerManager().getLevel()) .setLevel(query.getPlayerManager().getLevel())
@ -277,7 +283,7 @@ public abstract class AbstractRank implements IRank {
.setForce(query.getPlayerManager().getMaxFore()) .setForce(query.getPlayerManager().getMaxFore())
.setSex(query.getPlayerManager().getGender()) .setSex(query.getPlayerManager().getGender())
.setHead(query.getPlayerManager().getHead()) .setHead(query.getPlayerManager().getHead())
.setGuildName(query.getPlayerManager().getGuildName()) .setGuildName(mapEntry.getName())
.setHeadFrame(query.getPlayerManager().getHeadFrame()) .setHeadFrame(query.getPlayerManager().getHeadFrame())
.setUserMount(query.getPlayerManager().getUserMount()) .setUserMount(query.getPlayerManager().getUserMount())
.setUserSkin(query.getPlayerManager().getSkin()) .setUserSkin(query.getPlayerManager().getSkin())

View File

@ -7,6 +7,7 @@ import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.gm.ArenaOfUser; import com.ljsd.jieling.logic.dao.gm.ArenaOfUser;
import com.ljsd.jieling.logic.dao.root.GuildCache; import com.ljsd.jieling.logic.dao.root.GuildCache;
import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
import org.springframework.data.redis.core.ZSetOperations; import org.springframework.data.redis.core.ZSetOperations;
import rpc.protocols.CommonProto; import rpc.protocols.CommonProto;
import rpc.protocols.PlayerInfoProto; import rpc.protocols.PlayerInfoProto;
@ -27,7 +28,7 @@ public class CrossGuildForceRank extends GuildForceRank {
@Override @Override
protected void getCrossOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) throws Exception { protected void getCrossOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) throws Exception {
GuildCache mapEntry = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", data.getValue(), GuildCache.class); GuildCache mapEntry = CrossDeathPathLogic.getCrossGuild(Integer.parseInt(data.getValue()));
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder() CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
.setRank(index) .setRank(index)
.setParam1(getParam1(data.getScore())) .setParam1(getParam1(data.getScore()))
@ -71,7 +72,7 @@ public class CrossGuildForceRank extends GuildForceRank {
} }
ZSetOperations.TypedTuple<String> data = rankByKey.iterator().next(); ZSetOperations.TypedTuple<String> data = rankByKey.iterator().next();
GuildCache mapEntry = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", data.getValue(), GuildCache.class); GuildCache mapEntry = CrossDeathPathLogic.getCrossGuild(Integer.parseInt(data.getValue()));
if (mapEntry == null){ if (mapEntry == null){
return builder; return builder;
} }

View File

@ -10,6 +10,7 @@ import com.ljsd.jieling.logic.dao.gm.ArenaOfUser;
import com.ljsd.jieling.logic.dao.root.GuildCache; import com.ljsd.jieling.logic.dao.root.GuildCache;
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.logic.dao.root.User;
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
import com.ljsd.jieling.logic.family.DeathChallengeCount; import com.ljsd.jieling.logic.family.DeathChallengeCount;
import com.ljsd.jieling.logic.family.DeathPathLogic; import com.ljsd.jieling.logic.family.DeathPathLogic;
import rpc.protocols.CommonProto; import rpc.protocols.CommonProto;
@ -62,7 +63,7 @@ public class DeathPathTotalGuildRank extends CrossGuildForceRank{
@Override @Override
protected void getCrossOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) throws Exception { protected void getCrossOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) throws Exception {
GuildCache mapEntry = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", data.getValue(), GuildCache.class); GuildCache mapEntry = CrossDeathPathLogic.getCrossGuild(Integer.valueOf(data.getValue()));
DeathChallengeCount countInfo = DeathPathLogic.getInstance().getDeathChallengeCount(Integer.valueOf(data.getValue())); DeathChallengeCount countInfo = DeathPathLogic.getInstance().getDeathChallengeCount(Integer.valueOf(data.getValue()));
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder() CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
.setRank(index) .setRank(index)

View File

@ -114,6 +114,7 @@ public class MinuteTask extends Thread {
GuildFightLogic.familyFightStatus(); GuildFightLogic.familyFightStatus();
QuestionLogic.getInstence().checkQuestion(); QuestionLogic.getInstence().checkQuestion();
MailLogic.getInstance().checkReadyToMail(); MailLogic.getInstance().checkReadyToMail();
CrossDeathPathLogic.getInstance().sendChangeIndicationByCross();
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
LOGGER.error("Exception::=>{}",e.toString()); LOGGER.error("Exception::=>{}",e.toString());

View File

@ -94,11 +94,13 @@ public abstract class AbstractCrossRank extends AbstractRank {
return type; return type;
} }
public Set<ZSetOperations.TypedTuple<String>> getRankByKey(String rkey,int start,int end){ @Override
public Set<ZSetOperations.TypedTuple<String>> getRankByKey(String rkey, int start, int end){
return RedisUtil.getInstence().getZsetreverseRangeWithScores(redisKey, rkey, start, end); return RedisUtil.getInstence().getZsetreverseRangeWithScores(redisKey, rkey, start, end);
} }
@Override
protected PlayerInfoProto.RankResponse.Builder getAllUserResponse(Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores, int start) throws Exception{ protected PlayerInfoProto.RankResponse.Builder getAllUserResponse(Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores, int start) throws Exception{
PlayerInfoProto.RankResponse.Builder builder = PlayerInfoProto.RankResponse.newBuilder(); PlayerInfoProto.RankResponse.Builder builder = PlayerInfoProto.RankResponse.newBuilder();
forEach(start,zsetreverseRangeWithScores,(index,data)->{ forEach(start,zsetreverseRangeWithScores,(index,data)->{