Merge branch 'master_test_gn' into dev_dh_fourSpirit2
# Conflicts: # serverlogic/src/main/java/com/ljsd/jieling/logic/family/CrossDeathPathLogic.javaback_recharge
commit
771c39577e
|
@ -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_CHALLENGE_FIRST_PUSH = "DEATH_PATH_CHALLENGE_FIRST_PUSH";
|
||||
|
||||
//问卷调查
|
||||
public static final String QUESTION_FROMBACK = "QUESTION_FROMBACK";
|
||||
|
||||
|
|
|
@ -196,7 +196,11 @@ public class RedisUtil {
|
|||
}
|
||||
|
||||
public <T> T get(String type,String key,Class<T> tClass) {
|
||||
String rkey = getKey(type, key);
|
||||
return get(type,key,tClass,true);
|
||||
}
|
||||
|
||||
public <T> T get(String type,String key,Class<T> tClass,boolean judge) {
|
||||
String rkey = getKey(type, key, judge);
|
||||
String s = redisTemplate.opsForValue().get(rkey);
|
||||
if(StringUtil.isEmpty(s)){
|
||||
return null;
|
||||
|
@ -294,11 +298,13 @@ public class RedisUtil {
|
|||
}
|
||||
|
||||
public <T> void set(String type, String rkey, T t) {
|
||||
String key = getKey(type, rkey);
|
||||
redisTemplate.opsForValue().set(key, gson.toJson(t));
|
||||
set(type,rkey,t,true);
|
||||
}
|
||||
|
||||
|
||||
public <T> void set(String type, String rkey, T t, boolean judge) {
|
||||
String key = getKey(type, rkey,judge);
|
||||
redisTemplate.opsForValue().set(key, gson.toJson(t));
|
||||
}
|
||||
|
||||
public boolean lock(String lockKey, long lockExpireMils) {
|
||||
return (Boolean) redisTemplate.execute((RedisCallback) connection -> {
|
||||
|
@ -314,7 +320,7 @@ public class RedisUtil {
|
|||
//connection.getSet:返回这个key的旧值并设置新值。
|
||||
byte[] oldValue = connection.getSet(lockKey.getBytes(), String.valueOf(nowTime + lockExpireMils + 1).getBytes());
|
||||
//当key不存时会返回空,表示key不存在或者已在管道中使用
|
||||
return oldValue == null ? false : Long.parseLong(new String(oldValue)) < nowTime;
|
||||
return oldValue != null && Long.parseLong(new String(oldValue)) < nowTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.GuildInfo;
|
||||
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.mission.GameEvent;
|
||||
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()) {
|
||||
guildInfo.updateExp(guildInfo.getExp() + addexp - levelConfigMap.get(guildInfo.getLevel()).getExp());
|
||||
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), GuildCache.create(guildInfo));
|
||||
CrossDeathPathLogic.setCrossGuild(guildInfo);
|
||||
} else {
|
||||
guildInfo.updateExp(guildInfo.getExp() + addexp);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.ljsd.jieling.exception.ErrorCodeException;
|
|||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildCache;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
import config.SGuildLevelConfig;
|
||||
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()) {
|
||||
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
|
||||
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 {
|
||||
guildInfo.updateExp(guildInfo.getExp() + addexp);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.ljsd.jieling.logic.dao.root.User;
|
|||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.store.GiftGoodsType;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
@ -49,7 +50,7 @@ public class TreasureActivity extends AbstractActivity {
|
|||
LOGGER.info("[青龙秘宝初始化] [重置秘宝解锁状态] [uid:{}]",user.getId());
|
||||
user.getPlayerInfoManager().setHadBuyTreasure(0);
|
||||
}
|
||||
|
||||
reSetGood(user);
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.TREASH_MONTH_REFRESH, sGlobalActivity.getId());
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.TREASH_WEEK_REFRESH, sGlobalActivity.getId());
|
||||
|
@ -267,6 +268,15 @@ public class TreasureActivity extends AbstractActivity {
|
|||
getAllTreasureRewards(user, user.getActivityManager().getActivityMissionMap().get(id), getDestState(user), itemAttrs);
|
||||
}
|
||||
|
||||
public void reSetGood(User user){
|
||||
ReceiveWelfareBag bagInfo = (ReceiveWelfareBag) user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap().get(5001);
|
||||
if (bagInfo == null){
|
||||
return;
|
||||
}
|
||||
bagInfo.refresh();
|
||||
LOGGER.info("================青龙秘宝刷新===============,uid:{},id:{}",user.getId(),id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知客户端每周补给特权变动
|
||||
* @param sesson
|
||||
|
|
|
@ -138,7 +138,7 @@ public class CrossServiceLogic {
|
|||
arenaOfPlayerManager.setName(player.getNickName());
|
||||
arenaOfPlayerManager.setHead(player.getHead());
|
||||
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.setGuildName(mapEntry==null?"":mapEntry.getName());
|
||||
|
||||
|
|
|
@ -5,7 +5,12 @@ import com.ljsd.jieling.db.mongo.MongoUtil;
|
|||
import com.ljsd.jieling.db.mongo.core.CServerInfo;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.dao.GuildInfoCache;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildCache;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
|
@ -15,8 +20,10 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.redis.core.Cursor;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.*;
|
||||
|
@ -86,10 +93,10 @@ public class CrossDeathPathLogic {
|
|||
* @param guildId
|
||||
* @param pathId
|
||||
*/
|
||||
void addCrossDeathPathRank(int uid, int damage, int guildId, int pathId){
|
||||
void addCrossDeathPathRank(int uid, int damage, int guildId, int pathId) throws Exception {
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
//操作每个关的公会、个人数据
|
||||
BigDecimal decimal = new BigDecimal(String.valueOf(damage)).divide(new BigDecimal(String.valueOf(Math.pow(10,15))),6,BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal decimal = new BigDecimal(String.valueOf(damage)).divide(new BigDecimal(String.valueOf(Math.pow(10,15))));
|
||||
long everyGuildChangeScore = (long)damage*1000;
|
||||
AbstractRank everyPerson = RankContext.getRankEnum(RankEnum.DEATH_PATH_EVERY_PERSON_RANK.getType());
|
||||
if(redisUtil.getZSetScore(everyPerson.getCrossRedisKey(),String.valueOf(pathId), String.valueOf(uid), false)==-1){
|
||||
|
@ -107,6 +114,8 @@ public class CrossDeathPathLogic {
|
|||
if(!"".equals(before)){
|
||||
redisUtil.incrementZsetScore(totalGuild.getCrossRedisKey(),"",before, -1,false);
|
||||
}
|
||||
// 推送
|
||||
DeathPathLogic.getInstance().sendChangeIndicationCross(pathId,guildId);
|
||||
}
|
||||
AbstractRank totalPerson = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_PERSON_RANK.getType());
|
||||
// 个人单个排行
|
||||
|
@ -117,6 +126,9 @@ public class CrossDeathPathLogic {
|
|||
redisUtil.incrementZsetScore(totalGuild.getCrossRedisKey(),"",String.valueOf(guildId), decimal.doubleValue(),false);
|
||||
// 结算标识设置
|
||||
redisUtil.hset(RedisKey.DEATH_PATH_EVERY_OVER_HASH,String.valueOf(GameApplication.serverId),1);
|
||||
|
||||
User user = UserManager.getUser(uid);
|
||||
CrossServiceLogic.getInstance().dispose(user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,13 +136,32 @@ public class CrossDeathPathLogic {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public static GuildInfoCache getCrossGuild(int id){
|
||||
GuildInfoCache crossGuild = crossGuildMap.get(id);
|
||||
if(crossGuild==null){
|
||||
crossGuild = RedisUtil.getInstence().getMapEntry(RedisKey.GUILD_INFO_CACHE, "", String.valueOf(id), GuildInfoCache.class);
|
||||
crossGuildMap.put(id,crossGuild);
|
||||
public static GuildCache getCrossGuild(int id){
|
||||
return RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(id), GuildCache.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置公会缓存
|
||||
* @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()){
|
||||
LOGGER.info("跨服十绝阵第一推送===========:{}",map.toString());
|
||||
for (Map.Entry<Object, Object> entry : map.entrySet()) {
|
||||
int pathId = Integer.parseInt((String) entry.getKey());
|
||||
int guildId = Integer.parseInt((String) entry.getValue());
|
||||
DeathPathLogic.getInstance().sendChangeIndication(guildId,pathId);
|
||||
}
|
||||
}
|
||||
return crossGuild;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,7 +191,7 @@ public class CrossDeathPathLogic {
|
|||
* @param serverId
|
||||
* @return
|
||||
*/
|
||||
public Map<Integer,Integer> crossDeathPathReward(int groupId,int serverId){
|
||||
public Map<Integer,Integer> crossDeathPathReward(int groupId,int serverId) throws IOException {
|
||||
if(TimeUtils.getHourOfDay()!=0){
|
||||
return new HashMap<>(1);
|
||||
}
|
||||
|
@ -171,7 +202,7 @@ public class CrossDeathPathLogic {
|
|||
for(ZSetOperations.TypedTuple<String> value:values){
|
||||
rank++;
|
||||
int guildId = Integer.valueOf(value.getValue());
|
||||
GuildInfoCache guild = getCrossGuild(guildId);
|
||||
GuildCache guild = getCrossGuild(guildId);
|
||||
if(guild==null||guild.getServerId()!=serverId){
|
||||
continue;
|
||||
}
|
||||
|
@ -179,13 +210,10 @@ public class CrossDeathPathLogic {
|
|||
}
|
||||
RedisUtil.getInstence().hdel(RedisKey.DEATH_PATH_EVERY_OVER_HASH,String.valueOf(serverId));
|
||||
|
||||
Map<Object, Object> hmget = RedisUtil.getInstence().hmget(RedisKey.DEATH_PATH_EVERY_OVER_HASH);
|
||||
if (hmget == null || hmget.size() < 1) {
|
||||
Set<String> dimKey = RedisUtil.getInstence().getDimKey("DEATH_PATH*" + groupId + ":*", -1);
|
||||
for (String key : dimKey) {
|
||||
RedisUtil.getInstence().del(key);
|
||||
LOGGER.info("=================删除跨服十绝阵排行:{}", key);
|
||||
}
|
||||
Set<String> dimKey = RedisUtil.getInstence().getDimKey("DEATH_PATH*" + groupId + ":*", -1);
|
||||
for (String key : dimKey) {
|
||||
LOGGER.info("=================删除跨服十绝阵排行:{}", key);
|
||||
RedisUtil.getInstence().del(key);
|
||||
}
|
||||
return hashMap;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.ljsd.jieling.logic.GlobalDataManaager;
|
|||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
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.User;
|
||||
import com.ljsd.jieling.logic.fight.*;
|
||||
|
@ -81,7 +82,7 @@ public class DeathPathLogic {
|
|||
}
|
||||
|
||||
public void setGroupId(int groupId) {
|
||||
this.groupId = -1;
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
private BlockingQueue<DeathPathTask> tasks = new BlockingUniqueQueue<>();
|
||||
|
@ -300,7 +301,7 @@ public class DeathPathLogic {
|
|||
* @param session
|
||||
* @param messageType
|
||||
*/
|
||||
public void getBaseInfo(ISession session,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
public void getBaseInfo(ISession session,MessageTypeProto.MessageType messageType){
|
||||
int uid = session.getUid();
|
||||
String changeString = GameApplication.serverProperties.getId() + RedisKey.Delimiter_colon + RedisKey.DEATH_PATH_CHALLENGE_COUNT + RedisKey.Delimiter_colon + String.valueOf(uid);
|
||||
String count = (String) RedisUtil.getInstence().get(changeString);
|
||||
|
@ -319,22 +320,21 @@ public class DeathPathLogic {
|
|||
if (result) {
|
||||
key = guildRank.getCrossRedisKey();
|
||||
zSetReverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(key, String.valueOf(i), 0, 0,false);
|
||||
LOGGER.info("========================获取十绝阵内部信息,跨服:{}",uid);
|
||||
} else {
|
||||
key = guildRank.getRedisKey();
|
||||
zSetReverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(key, String.valueOf(i), 0, 0,true);
|
||||
LOGGER.info("========================获取十绝阵内部信息,本地:{}",uid);
|
||||
}
|
||||
Iterator<ZSetOperations.TypedTuple<String>> iterator = zSetReverseRangeWithScores.iterator();
|
||||
if (!iterator.hasNext()) {
|
||||
continue;
|
||||
}
|
||||
LOGGER.info("十绝阵信息,分组情况:{},排名信息:{}",getGroupId(),iterator.toString());
|
||||
ZSetOperations.TypedTuple<String> next = iterator.next();
|
||||
int guildId = Integer.parseInt(next.getValue());
|
||||
GuildInfoCache crossGuild = CrossDeathPathLogic.getCrossGuild(guildId);
|
||||
Integer serverId = Optional.ofNullable(CrossDeathPathLogic.getCrossGuild(guildId)).map(GuildInfoCache::getServerId).orElse(0);
|
||||
GuildCache crossGuild = CrossDeathPathLogic.getCrossGuild(guildId);
|
||||
Integer serverId = Optional.ofNullable(CrossDeathPathLogic.getCrossGuild(guildId)).map(GuildCache::getServerId).orElse(0);
|
||||
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);
|
||||
}
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
|
@ -351,7 +351,6 @@ public class DeathPathLogic {
|
|||
int uid = session.getUid();
|
||||
String changeStringKey = GameApplication.serverProperties.getId() + RedisKey.Delimiter_colon + RedisKey.DEATH_PATH_CHALLENGE_COUNT + RedisKey.Delimiter_colon + String.valueOf(uid);
|
||||
String count = (String) RedisUtil.getInstence().get(changeStringKey);
|
||||
//String count = RedisUtil.getInstence().get(RedisKey.DEATH_PATH_CHALLENGE_COUNT, String.valueOf(uid),String.class);
|
||||
if(!StringUtil.isEmpty(count)&&Integer.parseInt(count)>=SGuildSetting.sGuildSetting.getChallengeMaxTime()){
|
||||
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT);
|
||||
}
|
||||
|
@ -421,19 +420,22 @@ public class DeathPathLogic {
|
|||
}
|
||||
}
|
||||
}
|
||||
private void taskDoExecute(DeathPathTask task){
|
||||
|
||||
DeathChallengeCount countInfo = RedisUtil.getInstence().get(RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT, String.valueOf(task.getGuildId()), DeathChallengeCount.class);
|
||||
private void addChallengeCount(DeathPathTask task){
|
||||
DeathChallengeCount countInfo = getInstance().getDeathChallengeCount(task.getGuildId());
|
||||
if (countInfo==null){
|
||||
countInfo = new DeathChallengeCount();
|
||||
countInfo.putUserReward(task.getUid(),new DeathReward());
|
||||
RedisUtil.getInstence().set(RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT, String.valueOf(task.getGuildId()),countInfo);
|
||||
}else if(!countInfo.getUserReward().containsKey(task.getUid())) {
|
||||
countInfo.putUserReward(task.getUid(),new DeathReward());
|
||||
RedisUtil.getInstence().set(RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT, String.valueOf(task.getGuildId()), countInfo);
|
||||
}
|
||||
|
||||
getInstance().setDeathChallengeCount(task.getGuildId(),countInfo);
|
||||
}
|
||||
|
||||
private void taskDoExecute(DeathPathTask task){
|
||||
addChallengeCount(task);
|
||||
//跨服
|
||||
if(task.getGroupId()>0){
|
||||
if(getInstance().getGroupId()>0){
|
||||
try {
|
||||
CrossDeathPathLogic.getInstance().addCrossDeathPathRank(task.getUid(),task.getDamage(),task.getGuildId(),task.getPathId());
|
||||
LOGGER.info("==================跨服十绝阵上榜处理:{}",task.toString());
|
||||
|
@ -463,7 +465,7 @@ public class DeathPathLogic {
|
|||
//操作每个关的个人数据
|
||||
doRankAdd(personRank,guildRank,task);
|
||||
//第一名推送
|
||||
sendChangeIndication(task.getGuildId(),task.getPathId());
|
||||
getInstance().sendChangeIndication(task.getGuildId(),task.getPathId());
|
||||
|
||||
}else{
|
||||
ZSetOperations.TypedTuple<String> next = iterator.next();
|
||||
|
@ -477,7 +479,7 @@ public class DeathPathLogic {
|
|||
guildTotalRank.addRank(task.getGuildId(),"",task.getDamage());
|
||||
}else{
|
||||
//第一名更改时推送
|
||||
sendChangeIndication(currFirstGuildId,task.getPathId());
|
||||
getInstance().sendChangeIndication(currFirstGuildId,task.getPathId());
|
||||
guildTotalRank.addRank(currFirstGuildId,"",task.getDamage(),1);
|
||||
guildTotalRank.addRank(firstGuildId,"",0,-1);
|
||||
}
|
||||
|
@ -485,27 +487,6 @@ public class DeathPathLogic {
|
|||
}
|
||||
}
|
||||
|
||||
private void sendChangeIndication(int currFirstGuildId,int pathId){
|
||||
AbstractRank guildTotalRank = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_GUILD_RANK.getType());
|
||||
Set<ZSetOperations.TypedTuple<String>> allGuild = guildTotalRank.getRankByKey("", 0, -1);
|
||||
String name = GuilidManager.guildInfoMap.get(currFirstGuildId).getName();
|
||||
allGuild.forEach(n-> {
|
||||
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){
|
||||
GuildLogic.sendIndicationToMember(guildInfo, MessageTypeProto.MessageType.DEATH_PATH_FIRST_CHANGE_INDICATION,indication);
|
||||
}else{
|
||||
LOGGER.error("Exception公会信息为空,不能发送推送,公会id为{}",n.getValue());
|
||||
}
|
||||
});
|
||||
LOGGER.info("信息修改,需要推送");
|
||||
}
|
||||
|
||||
|
||||
//判断改阵排行榜中是否有我打过的信息,没有加个人数
|
||||
private void doRankAdd(AbstractRank personRank,AbstractRank guildRank ,DeathPathTask task){
|
||||
if(personRank.getScoreById(task.getUid(),String.valueOf(task.getPathId()))==-1){
|
||||
|
@ -517,6 +498,33 @@ public class DeathPathLogic {
|
|||
}
|
||||
}
|
||||
|
||||
public void sendChangeIndication(int currFirstGuildId,int pathId){
|
||||
AbstractRank guildTotalRank = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_GUILD_RANK.getType());
|
||||
Set<ZSetOperations.TypedTuple<String>> allGuild;
|
||||
if (getGroupId() > 0){
|
||||
allGuild = guildTotalRank.getCrossRankByKey("", 0, -1);
|
||||
}else {
|
||||
allGuild = guildTotalRank.getRankByKey("", 0, -1);
|
||||
}
|
||||
for (ZSetOperations.TypedTuple<String> n : allGuild) {
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(n.getValue()));
|
||||
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);
|
||||
}else{
|
||||
LOGGER.error("Exception公会信息为空,不能发送推送,公会id为{}",n.getValue());
|
||||
}
|
||||
}
|
||||
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,60);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有翻拍信息
|
||||
* @param session
|
||||
|
@ -524,7 +532,7 @@ public class DeathPathLogic {
|
|||
*/
|
||||
public void getAllRewardInfo(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
DeathChallengeCount countInfo = RedisUtil.getInstence().get(RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT, String.valueOf(user.getPlayerInfoManager().getGuildId()), DeathChallengeCount.class);
|
||||
DeathChallengeCount countInfo = getDeathChallengeCount(user.getPlayerInfoManager().getGuildId());
|
||||
Family.GetAllDeathPathRewardInfoResponse.Builder response = Family.GetAllDeathPathRewardInfoResponse.newBuilder();
|
||||
if(countInfo==null){
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
|
@ -554,7 +562,7 @@ public class DeathPathLogic {
|
|||
User user = UserManager.getUser(uid);
|
||||
|
||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
DeathChallengeCount countInfo = RedisUtil.getInstence().get(RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT, String.valueOf(guildId), DeathChallengeCount.class);
|
||||
DeathChallengeCount countInfo = getDeathChallengeCount(guildId);
|
||||
if (countInfo==null||!countInfo.getUserReward().containsKey(uid)){
|
||||
//您所在的公会或您没有达到领奖条件
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
|
@ -580,7 +588,7 @@ public class DeathPathLogic {
|
|||
}
|
||||
int[] reward = getRewardByRank(rank);
|
||||
countInfo.putUserReward(uid,new DeathReward(reward[0],reward[1],position,user.getPlayerInfoManager().getNickName()));
|
||||
RedisUtil.getInstence().set(RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT, String.valueOf(guildId),countInfo);
|
||||
setDeathChallengeCount(guildId,countInfo);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[][]{reward}, BIReason.DEATH_PAHT_RANDOM_REWARD);
|
||||
Family.DoRewardDeathPathResponse response =Family.DoRewardDeathPathResponse.newBuilder().setDrop(drop).build();
|
||||
Family.RewardInfo info = Family.RewardInfo.newBuilder().setUid(uid).setItemCount(reward[1]).setItemId(reward[0]).setPosition(position).setUsername(user.getPlayerInfoManager().getNickName()).build();
|
||||
|
@ -613,44 +621,49 @@ public class DeathPathLogic {
|
|||
* @throws Exception
|
||||
*/
|
||||
public void deleteDeathPathInfo() throws Exception {
|
||||
// redis工具
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
// 本服id
|
||||
int serverId = GameApplication.serverId;
|
||||
Map<Integer, Integer> map;
|
||||
if(getGroupId() > 0){
|
||||
//是否跨服
|
||||
LOGGER.info("===================跨服十绝阵排行榜结束处理,分组:{},区服:{}",getGroupId(),serverId);
|
||||
Map<Integer, Integer> map = CrossDeathPathLogic.getInstance().crossDeathPathReward(getGroupId(), serverId);
|
||||
if(map.isEmpty()){
|
||||
LOGGER.error("===================无跨服十绝阵排行信息");
|
||||
return;
|
||||
}
|
||||
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
|
||||
DeathChallengeCount reward = redisUtil.getObject(serverId+":"+RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT+":"+entry.getValue(), DeathChallengeCount.class);
|
||||
int[] rewardByRank = getRewardByRank(entry.getKey());
|
||||
deathPathSendMail(reward,rewardByRank);
|
||||
}
|
||||
map = CrossDeathPathLogic.getInstance().crossDeathPathReward(getGroupId(), serverId);
|
||||
}else {
|
||||
LOGGER.info("===================本地十绝阵排行榜结束处理,分组:{},区服:{}",getGroupId(),serverId);
|
||||
//本服发奖
|
||||
AbstractRank guildRank = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_GUILD_RANK.getType());
|
||||
Set<ZSetOperations.TypedTuple<String>> guildRankSet = guildRank.getRankByKey("", 0, -1);
|
||||
if(guildRankSet.isEmpty()){
|
||||
return;
|
||||
}
|
||||
int index = 1;
|
||||
for(ZSetOperations.TypedTuple<String> item:guildRankSet){
|
||||
String key = RedisKey.getKey(RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT, item.getValue(),false);
|
||||
DeathChallengeCount reward = redisUtil.getObject(key, DeathChallengeCount.class);
|
||||
int[] rewardByRank = getRewardByRank(index);
|
||||
deathPathSendMail(reward,rewardByRank);
|
||||
index++;
|
||||
}
|
||||
LOGGER.info("===================本地十绝阵排行榜结束处理,分组:{},区服:{}",getGroupId(),serverId);
|
||||
map = deathPathReward();
|
||||
}
|
||||
|
||||
// 循环发奖
|
||||
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
|
||||
DeathChallengeCount reward = getDeathChallengeCount(entry.getValue());
|
||||
int[] rewardByRank = getRewardByRank(entry.getKey());
|
||||
deathPathSendMail(reward,rewardByRank);
|
||||
}
|
||||
Set<String> keys = RedisUtil.getInstence().getDimKey(serverId + ":DEATH_PATH*", -1);
|
||||
keys.forEach(key-> RedisUtil.getInstence().del(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地奖励排行
|
||||
* @return
|
||||
*/
|
||||
private Map<Integer, Integer> deathPathReward(){
|
||||
HashMap<Integer, Integer> hashMap = new HashMap<>();
|
||||
//本服发奖
|
||||
AbstractRank guildRank = RankContext.getRankEnum(RankEnum.DEATH_PATH_TOTAL_GUILD_RANK.getType());
|
||||
Set<ZSetOperations.TypedTuple<String>> guildRankSet = guildRank.getRankByKey("", 0, -1);
|
||||
if(guildRankSet.isEmpty()){
|
||||
return hashMap;
|
||||
}
|
||||
int index = 1;
|
||||
for(ZSetOperations.TypedTuple<String> item:guildRankSet){
|
||||
index++;
|
||||
hashMap.put(index,Integer.parseInt(item.getValue()));
|
||||
}
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
private void deathPathSendMail(DeathChallengeCount reward,int[] rewardByRank) throws Exception {
|
||||
// 邮件标题和内容
|
||||
String mailTitle = SErrorCodeEerverConfig.getI18NMessage("guildwar_reward_title");
|
||||
|
@ -689,10 +702,40 @@ public class DeathPathLogic {
|
|||
String openTime = GameApplication.serverConfig.getOpenTime();
|
||||
long before = TimeUtils.stringToTimeLong2(openTime);
|
||||
long after = TimeUtils.now();
|
||||
int week = SGuildSetting.sGuildSetting.getCrossServerOpenWeek();
|
||||
int week = SGuildSetting.sGuildSetting.getCrossServerOpenWeek()-1;
|
||||
boolean byWeek = TimeUtils.isAfterTimeByWeek(before, after, week);
|
||||
// 分组验证
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
return byWeek && crossGroup != -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取挑战人数
|
||||
* @return
|
||||
*/
|
||||
public DeathChallengeCount getDeathChallengeCount(int guildId){
|
||||
DeathChallengeCount challengeCount;
|
||||
String key = RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT;
|
||||
if (getGroupId() > 0){
|
||||
key = RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT + ":" + GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
challengeCount = RedisUtil.getInstence().get(key, String.valueOf(guildId), DeathChallengeCount.class, false);
|
||||
}else {
|
||||
challengeCount = RedisUtil.getInstence().get(key, String.valueOf(guildId), DeathChallengeCount.class,true);
|
||||
}
|
||||
return challengeCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取挑战人数
|
||||
* @return
|
||||
*/
|
||||
public void setDeathChallengeCount(int guildId, DeathChallengeCount countInfo){
|
||||
String key = RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT;
|
||||
if (getGroupId() > 0){
|
||||
key = RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT + ":" + GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
RedisUtil.getInstence().set(key, String.valueOf(guildId),countInfo,false);
|
||||
}else {
|
||||
RedisUtil.getInstence().set(key, String.valueOf(guildId),countInfo,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ public class GuildChallengeLogic {
|
|||
if (GuildLogic.checkGuildLevelMax(guildInfo)&&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);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), GuildCache.create(guildInfo));
|
||||
CrossDeathPathLogic.setCrossGuild(guildInfo);
|
||||
} else {
|
||||
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()) {
|
||||
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp() - levelConfigMap.get(guildInfo.getLevel()).getExp());
|
||||
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(guildInfo.getId()), GuildCache.create(guildInfo));
|
||||
CrossDeathPathLogic.setCrossGuild(guildInfo);
|
||||
} else {
|
||||
guildInfo.updateExp(guildInfo.getExp() + config.getLegionExp());
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
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);
|
||||
Family.FamilyFightInfo.Builder fightInfo = Family.FamilyFightInfo.newBuilder();
|
||||
fightInfo.setGid(guildId);
|
||||
|
@ -387,8 +383,7 @@ public class GuildFightLogic {
|
|||
continue;
|
||||
}
|
||||
GuildInfo guildInfo = entry.getValue();
|
||||
GuildCache enemyInfo = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", String.valueOf(enemyFamily), GuildCache.class);
|
||||
// GuildInfo enemyInfo = GuilidManager.guildInfoMap.get(enemyFamily);
|
||||
GuildCache enemyInfo = CrossDeathPathLogic.getCrossGuild(enemyFamily);
|
||||
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder().setId(enemyFamily)
|
||||
.setLevel(enemyInfo.getLevel())
|
||||
.setName(Optional.ofNullable(enemyInfo).map(GuildCache::getName).orElse(""))
|
||||
|
@ -562,12 +557,12 @@ public class GuildFightLogic {
|
|||
response.setJoinType(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){
|
||||
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder()
|
||||
.setId(enemyFamily)
|
||||
.setLevel(enemyInfo.getLevel())
|
||||
.setName(Optional.ofNullable(enemyInfo).map(GuildCache::getName).orElse(""))
|
||||
.setName(Optional.of(enemyInfo).map(GuildCache::getName).orElse(""))
|
||||
.setPictureId(enemyInfo.getIcon())
|
||||
.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))
|
||||
|
@ -819,7 +814,7 @@ public class GuildFightLogic {
|
|||
if(guildInfo.getExp()+getExp>=levelConfigMap.get(guildInfo.getLevel()).getExp()){
|
||||
guildInfo.updateExp(guildInfo.getExp()+getExp-levelConfigMap.get(guildInfo.getLevel()).getExp());
|
||||
GuildLogic.upLevel(guildInfo,guildInfo.getLevel() + 1);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_INFO,"", String.valueOf(guildInfo.getId()),GuildCache.create(guildInfo));
|
||||
CrossDeathPathLogic.setCrossGuild(guildInfo);
|
||||
}else{
|
||||
guildInfo.updateExp(guildInfo.getExp()+getExp);
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ public class GuildLogic {
|
|||
GuilidManager.addGuildInfo(guildInfo);
|
||||
user.getPlayerInfoManager().setGuildId(guildInfo.getId());
|
||||
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);
|
||||
cache.setGuildPosition(GlobalsDef.CHAIRMAN);
|
||||
|
@ -844,7 +844,7 @@ public class GuildLogic {
|
|||
}
|
||||
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);
|
||||
}
|
||||
|
@ -1158,7 +1158,7 @@ public class GuildLogic {
|
|||
}
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId());
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public class FightRecordLogic {
|
|||
strings.add(str);
|
||||
// 重新赋值
|
||||
multiValueMap.put(multiKey,strings);
|
||||
System.out.println("fightId======================="+fightData.getFightId());
|
||||
// System.out.println("fightId======================="+fightData.getFightId());
|
||||
recordMap.put(uid,multiValueMap);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.ljsd.jieling.logic.GlobleSystemLogic;
|
|||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildCache;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -100,7 +101,7 @@ public class CrossRankManager {
|
|||
public void guildCacheHandle(){
|
||||
Map<Integer, GuildInfo> guildInfoMap = GuilidManager.guildInfoMap;
|
||||
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("==================工会缓存处理=============");
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
|||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.gm.ArenaOfUser;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
|
||||
import com.ljsd.jieling.logic.rank.IRank;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -147,6 +148,10 @@ public abstract class AbstractRank implements IRank {
|
|||
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 {
|
||||
Set<ZSetOperations.TypedTuple<String>> rankByKey = getRankByKey(activityId==0?"":String.valueOf(activityId), 0, 0);
|
||||
|
@ -265,6 +270,7 @@ public abstract class AbstractRank implements IRank {
|
|||
|
||||
public CommonProto.UserRank.Builder getCrossOneUserRank(ArenaOfUser query, CommonProto.RankInfo.Builder everyRankInfo){
|
||||
String serverName = CrossServiceLogic.getInstance().getServerNameByUId(query.getId());
|
||||
GuildCache mapEntry = CrossDeathPathLogic.getCrossGuild(query.getPlayerManager().getGuildId());
|
||||
return CommonProto.UserRank.newBuilder()
|
||||
.setUid(query.getId())
|
||||
.setLevel(query.getPlayerManager().getLevel())
|
||||
|
@ -273,7 +279,7 @@ public abstract class AbstractRank implements IRank {
|
|||
.setForce(query.getPlayerManager().getMaxFore())
|
||||
.setSex(query.getPlayerManager().getGender())
|
||||
.setHead(query.getPlayerManager().getHead())
|
||||
.setGuildName(query.getPlayerManager().getGuildName())
|
||||
.setGuildName(mapEntry.getName())
|
||||
.setHeadFrame(query.getPlayerManager().getHeadFrame())
|
||||
.setUserMount(query.getPlayerManager().getUserMount())
|
||||
.setUserSkin(query.getPlayerManager().getSkin())
|
||||
|
|
|
@ -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.root.GuildCache;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
@ -27,7 +28,7 @@ public class CrossGuildForceRank extends GuildForceRank {
|
|||
|
||||
@Override
|
||||
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()
|
||||
.setRank(index)
|
||||
.setParam1(getParam1(data.getScore()))
|
||||
|
@ -37,7 +38,7 @@ public class CrossGuildForceRank extends GuildForceRank {
|
|||
if (query == null){
|
||||
return;
|
||||
}
|
||||
String name = Optional.ofNullable(mapEntry).map(GuildCache::getName).orElse("");
|
||||
String name = Optional.of(mapEntry).map(GuildCache::getName).orElse("");
|
||||
CommonProto.UserRank.Builder oneUserRank = getCrossOneUserRank(query,name,everyRankInfo);
|
||||
builder.addRanks(oneUserRank);
|
||||
}
|
||||
|
@ -71,7 +72,7 @@ public class CrossGuildForceRank extends GuildForceRank {
|
|||
}
|
||||
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){
|
||||
return builder;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.ljsd.jieling.db.redis.RedisUtil;
|
|||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.family.DeathPathLogic;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
@ -14,7 +15,7 @@ import rpc.protocols.PlayerInfoProto;
|
|||
* @date 2020/5/7
|
||||
* @discribe
|
||||
*/
|
||||
public class DeathPathEveryGuildRank extends AbstractRank {
|
||||
public class DeathPathEveryGuildRank extends CrossGuildForceRank {
|
||||
public DeathPathEveryGuildRank(int type, String redisKey) {
|
||||
super(type, redisKey);
|
||||
}
|
||||
|
@ -62,4 +63,13 @@ public class DeathPathEveryGuildRank extends AbstractRank {
|
|||
.setParam2(getParam2(zSetScore)).build();
|
||||
allUserResponse.setMyRankInfo(towerRankInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerInfoProto.RankResponse getCrossRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
|
||||
if (DeathPathLogic.getInstance().getGroupId() > 0){
|
||||
return super.getCrossRank(uid,rkey,page,rankEndLine);
|
||||
}else {
|
||||
return getRank(uid,rkey,page,rankEndLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.family.DeathPathLogic;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
|
@ -27,4 +29,13 @@ public class DeathPathEveryPersonRank extends AbstractRank {
|
|||
public void addRank(int uid,String rkey,double... data){
|
||||
RedisUtil.getInstence().incrementZsetScore(redisKey,rkey,String.valueOf(uid), Double.valueOf(getScore(data)).intValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerInfoProto.RankResponse getCrossRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
|
||||
if (DeathPathLogic.getInstance().getGroupId() > 0){
|
||||
return super.getCrossRank(uid,rkey,page,rankEndLine);
|
||||
}else {
|
||||
return super.getRank(uid,rkey,page,rankEndLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,23 +3,29 @@ 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.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.gm.ArenaOfUser;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildCache;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
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.DeathPathLogic;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2020/5/8
|
||||
* @discribe
|
||||
*/
|
||||
public class DeathPathTotalGuildRank extends AbstractRank{
|
||||
public class DeathPathTotalGuildRank extends CrossGuildForceRank{
|
||||
public DeathPathTotalGuildRank(int type, String redisKey) {
|
||||
super(type, redisKey);
|
||||
}
|
||||
|
@ -42,12 +48,12 @@ public class DeathPathTotalGuildRank extends AbstractRank{
|
|||
@Override
|
||||
protected void getOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) throws Exception {
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(data.getValue()));
|
||||
DeathChallengeCount countInfo = RedisUtil.getInstence().get(RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT, String.valueOf(guildInfo.getId()), DeathChallengeCount.class);
|
||||
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
DeathChallengeCount countInfo = DeathPathLogic.getInstance().getDeathChallengeCount(guildInfo.getId());
|
||||
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(index)
|
||||
.setParam1(getParam1(data.getScore()))
|
||||
.setParam2(getParam2(data.getScore()))
|
||||
.setParam3(countInfo==null?0:countInfo.getUserReward().size());
|
||||
.setParam3(countInfo==null?0:countInfo.getUserReward().size());
|
||||
CommonProto.UserRank.Builder everyRank = CommonProto.UserRank.newBuilder()
|
||||
.setUid(guildInfo.getId())
|
||||
.setGuildName(guildInfo.getName())
|
||||
|
@ -55,17 +61,53 @@ public class DeathPathTotalGuildRank extends AbstractRank{
|
|||
builder.addRanks(everyRank);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCrossOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) throws Exception {
|
||||
GuildCache mapEntry = CrossDeathPathLogic.getCrossGuild(Integer.valueOf(data.getValue()));
|
||||
DeathChallengeCount countInfo = DeathPathLogic.getInstance().getDeathChallengeCount(Integer.valueOf(data.getValue()));
|
||||
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(index)
|
||||
.setParam1(getParam1(data.getScore()))
|
||||
.setParam2(getParam2(data.getScore()))
|
||||
.setParam3(countInfo==null?0:countInfo.getUserReward().size());
|
||||
ArenaOfUser query = CrossServiceLogic.getInstance().query(mapEntry.getLeaderUId());
|
||||
if (query == null){
|
||||
return;
|
||||
}
|
||||
String name = Optional.of(mapEntry).map(GuildCache::getName).orElse("");
|
||||
CommonProto.UserRank.Builder oneUserRank = getCrossOneUserRank(query,name,everyRankInfo);
|
||||
builder.addRanks(oneUserRank);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCrossMyInfo(User user,String rkey,PlayerInfoProto.RankResponse.Builder allUserResponse){
|
||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
if (guildId == 0){
|
||||
return;
|
||||
}
|
||||
DeathChallengeCount countInfo = DeathPathLogic.getInstance().getDeathChallengeCount(guildId);
|
||||
int myRank= RedisUtil.getInstence().getZSetreverseRank(getCrossRedisKey(),rkey,Integer.toString(guildId),false).intValue();
|
||||
Double zSetScore = RedisUtil.getInstence().getZSetScore(getCrossRedisKey(), rkey, Integer.toString(guildId),false);
|
||||
CommonProto.RankInfo towerRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(myRank)
|
||||
.setParam1(getParam1(zSetScore))
|
||||
.setParam2(countInfo==null?0:countInfo.getUserReward().size())
|
||||
.build();
|
||||
allUserResponse.setMyRankInfo(towerRankInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getMyInfo(User user, String rkey, PlayerInfoProto.RankResponse.Builder allUserResponse) {
|
||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
DeathChallengeCount countInfo = RedisUtil.getInstence().get(RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT, String.valueOf(guildId), DeathChallengeCount.class);
|
||||
DeathChallengeCount countInfo = DeathPathLogic.getInstance().getDeathChallengeCount(guildId);
|
||||
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))
|
||||
.setParam3(countInfo==null?0:countInfo.getUserReward().size()).build();
|
||||
.setParam3(countInfo==null?0:countInfo.getUserReward().size())
|
||||
.build();
|
||||
allUserResponse.setMyRankInfo(towerRankInfo);
|
||||
}
|
||||
|
||||
|
@ -73,4 +115,13 @@ public class DeathPathTotalGuildRank extends AbstractRank{
|
|||
public void addRank(int uid, String rkey, double... data) {
|
||||
RedisUtil.getInstence().incrementZsetScore(redisKey,rkey,String.valueOf(uid), getScore(data));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerInfoProto.RankResponse getCrossRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
|
||||
if (DeathPathLogic.getInstance().getGroupId() > 0){
|
||||
return super.getCrossRank(uid,rkey,page,rankEndLine);
|
||||
}else {
|
||||
return super.getRank(uid,rkey,page,rankEndLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.family.DeathPathLogic;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
|
@ -27,4 +29,13 @@ public class DeathPathTotalPersonRank extends AbstractRank {
|
|||
public void addRank(int uid, String rkey, double... data) {
|
||||
RedisUtil.getInstence().incrementZsetScore(redisKey,rkey,String.valueOf(uid), getScore(data));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerInfoProto.RankResponse getCrossRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
|
||||
if (DeathPathLogic.getInstance().getGroupId() > 0){
|
||||
return super.getCrossRank(uid,rkey,page,rankEndLine);
|
||||
}else {
|
||||
return super.getRank(uid,rkey,page,rankEndLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,6 +119,7 @@ public class MinuteTask extends Thread {
|
|||
GuildFightLogic.familyFightStatus();
|
||||
QuestionLogic.getInstence().checkQuestion();
|
||||
MailLogic.getInstance().checkReadyToMail();
|
||||
CrossDeathPathLogic.getInstance().sendChangeIndicationByCross();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
LOGGER.error("Exception::=>{}",e.toString());
|
||||
|
|
|
@ -94,11 +94,13 @@ public abstract class AbstractCrossRank extends AbstractRank {
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected PlayerInfoProto.RankResponse.Builder getAllUserResponse(Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores, int start) throws Exception{
|
||||
PlayerInfoProto.RankResponse.Builder builder = PlayerInfoProto.RankResponse.newBuilder();
|
||||
forEach(start,zsetreverseRangeWithScores,(index,data)->{
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.world.logic.rank;
|
|||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.logic.dao.GuildInfoCache;
|
||||
import com.ljsd.jieling.logic.family.DeathChallengeCount;
|
||||
import com.ljsd.jieling.logic.family.DeathPathLogic;
|
||||
import com.world.db.mongo.MongoUtil;
|
||||
import com.world.redis.RedisUtil;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
|
@ -36,10 +37,11 @@ public class DeathPathCrossTotalGuildRank extends AbstractCrossRank {
|
|||
}
|
||||
return decimal.doubleValue();
|
||||
}
|
||||
protected void getOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) throws Exception {
|
||||
|
||||
@Override
|
||||
protected void getOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) throws Exception {
|
||||
GuildInfoCache crossGuild = getCrossGuild(Integer.parseInt(data.getValue()));
|
||||
DeathChallengeCount countInfo = RedisUtil.getInstence().getObject(crossGuild.getServerId()+":"+RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT+":"+String.valueOf(data.getValue()), DeathChallengeCount.class);
|
||||
DeathChallengeCount countInfo = DeathPathLogic.getInstance().getDeathChallengeCount(crossGuild.getGuildId());
|
||||
GuildInfoCache everyGuild =getCrossGuild(Integer.parseInt(data.getValue()));
|
||||
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(index)
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
package com.world.logic.rank;
|
||||
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.logic.dao.GuildInfoCache;
|
||||
import com.ljsd.jieling.logic.family.DeathChallengeCount;
|
||||
import com.world.db.mongo.MongoUtil;
|
||||
import com.world.redis.RedisUtil;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
@ -36,19 +31,6 @@ public class WorldArenaRank extends AbstractCrossRank {
|
|||
}
|
||||
return decimal.doubleValue();
|
||||
}
|
||||
protected void getOptional(int index, ZSetOperations.TypedTuple<String> data, PlayerInfoProto.RankResponse.Builder builder) throws Exception {
|
||||
|
||||
GuildInfoCache crossGuild = getCrossGuild(Integer.parseInt(data.getValue()));
|
||||
DeathChallengeCount countInfo = RedisUtil.getInstence().getObject(crossGuild.getServerId()+":"+RedisKey.DEATH_PATH_TOTAL_CHALLENGE_COUNT+":"+String.valueOf(data.getValue()), DeathChallengeCount.class);
|
||||
GuildInfoCache everyGuild =getCrossGuild(Integer.parseInt(data.getValue()));
|
||||
CommonProto.RankInfo.Builder everyRankInfo = CommonProto.RankInfo.newBuilder()
|
||||
.setRank(index)
|
||||
.setParam1(getParam1(data.getScore()))
|
||||
.setParam2(getParam2(data.getScore()))
|
||||
.setParam3(countInfo==null?0:countInfo.getUserReward().size());
|
||||
CommonProto.UserRank.Builder oneUserRank = getOneUserRank(everyGuild, everyRankInfo);
|
||||
builder.addRanks(oneUserRank);
|
||||
}
|
||||
|
||||
public CommonProto.UserRank.Builder getOneUserRank(GuildInfoCache everyGuild,CommonProto.RankInfo.Builder everyRankInfo) throws Exception {
|
||||
CommonProto.UserRank.Builder everyRank = CommonProto.UserRank.newBuilder()
|
||||
|
|
Loading…
Reference in New Issue