玩家清除 和日志打印

zhangshanxue 2020-08-09 22:37:25 +08:00
parent 331c386003
commit a78faa7d4b
3 changed files with 58 additions and 40 deletions

View File

@ -193,8 +193,10 @@ public class ChampionshipLogic {
// }
// }
if(schedule==2&&(ChampionshipLogic.fightTime!=3)){
return;
if(schedule==2){
if(fightTime!=0||realTimes!=1){
if(ChampionshipLogic.fightTime!=3) return;
}
}
//胜利者积分排名
@ -366,24 +368,29 @@ public class ChampionshipLogic {
Map<Integer, SArenaRobotConfig> robotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
int nowTime = (int) (TimeUtils.now() / 1000);
Set<Integer> joinUids = new HashSet<>(128);
for (ZSetOperations.TypedTuple<String> item : arenaRankInfo) {
String uidStr = item.getValue();
int uid = Integer.parseInt(uidStr);
if (robotConfigMap.containsKey(uid)) {
try {
for (ZSetOperations.TypedTuple<String> item : arenaRankInfo) {
String uidStr = item.getValue();
int uid = Integer.parseInt(uidStr);
if (robotConfigMap.containsKey(uid)) {
rank++;
continue;
}
joinUids.add(uid);
User user = UserManager.getUser(uid);
SChampionshipReward sChampionshipReward = rewardsMap.get(rank);
if (user.getArenaManager().getTopMaxRank() == 0 || user.getArenaManager().getTopMaxRank() > rank) {
user.getArenaManager().setTopMaxRank(rank);
}
rank++;
continue;
String title = SErrorCodeEerverConfig.getI18NMessage("champion_reward_title");
String content = SErrorCodeEerverConfig.getI18NMessage("champion_reward_txt", new Object[]{sChampionshipReward.getTitleDesc()});
MailLogic.getInstance().sendMail(user.getId(), title, content, ItemUtil.getMailReward(sChampionshipReward.getSeasonReward()), nowTime, Global.MAIL_EFFECTIVE_TIME);
}
joinUids.add(uid);
User user = UserManager.getUser(uid);
SChampionshipReward sChampionshipReward = rewardsMap.get(rank);
if (user.getArenaManager().getTopMaxRank() == 0 || user.getArenaManager().getTopMaxRank() > rank) {
user.getArenaManager().setTopMaxRank(rank);
}
rank++;
String title = SErrorCodeEerverConfig.getI18NMessage("champion_reward_title");
String content = SErrorCodeEerverConfig.getI18NMessage("champion_reward_txt", new Object[]{sChampionshipReward.getTitleDesc()});
MailLogic.getInstance().sendMail(user.getId(), title, content, ItemUtil.getMailReward(sChampionshipReward.getSeasonReward()), nowTime, Global.MAIL_EFFECTIVE_TIME);
}catch (Exception e){
System.out.println("Exception e = "+"size"+ arenaRankInfo.size()+ e.toString());
}
MongoUtil.getLjsdMongoTemplate().lastUpdate();
SChampionshipSetting sChampionshipSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting();
int arenaItemId = sChampionshipSetting.getArenaItem()[0];
@ -1162,6 +1169,12 @@ public class ChampionshipLogic {
int duration = sChampionshipSetting.getGuessTime() + sChampionshipSetting.getBattleTime(); //fix 只有竞猜和战斗
int progressState = getProgress((int) ((now - startTime) / 1000 % duration + 1)); //阶段
long round = (now - startTime) / 1000 / duration + 1;//轮数
if(round>30){
progress=-2;
//sendAllProgressUpdate();
return;
}
roundTimes = (int) round;
long diff = round - (sChampionshipSetting.getTrialsGroup() - 1);
int progressTmp;
@ -1226,10 +1239,6 @@ public class ChampionshipLogic {
}
progress = progressTmp;
scoreToRedis();
if(fightTime==0){
// String key = RedisUtil.getInstence().getKey(RedisKey.CHAMPION_ARENA_RECORD_THREE, "");
// RedisUtil.getInstence().del(key, RedisUtil.getInstence().getKey(RedisKey.CHAMPION_ARENA_RECORD_THREE, ""));
}
fightTime++;
//准备阶段
selectToBattle();

View File

@ -52,18 +52,18 @@ public class UserManager {
//离线清除逻辑
public static void checkOffline(){
try {
Set<User> collect = userMap.entrySet().stream().filter(integerUserEntry -> !OnlineUserManager.checkUidOnline(integerUserEntry.getKey())).map(Map.Entry::getValue).collect(Collectors.toSet());
long l = System.currentTimeMillis();
collect.forEach(integerUserEntry -> {
long offLineTime = integerUserEntry.getPlayerInfoManager().getOffLineTime();
if(offLineTime<integerUserEntry.getPlayerInfoManager().getOnlineTime()){
return;
}
if(l-offLineTime>7*60*1000&& userMapPutTime.getOrDefault(integerUserEntry.getId(),0L)>7*60*100){
userMap.remove(integerUserEntry.getId());
userMapPutTime.remove(integerUserEntry.getId());
}
});
// Set<User> collect = userMap.entrySet().stream().filter(integerUserEntry -> !OnlineUserManager.checkUidOnline(integerUserEntry.getKey())).map(Map.Entry::getValue).collect(Collectors.toSet());
// long l = System.currentTimeMillis();
// collect.forEach(integerUserEntry -> {
// long offLineTime = integerUserEntry.getPlayerInfoManager().getOffLineTime();
// if(offLineTime<integerUserEntry.getPlayerInfoManager().getOnlineTime()){
// return;
// }
// if(l-offLineTime>12*60*60*1000&& userMapPutTime.getOrDefault(integerUserEntry.getId(),0L)>12*60*60*1000){
// userMap.remove(integerUserEntry.getId());
// userMapPutTime.remove(integerUserEntry.getId());
// }
// });
}catch (Exception e){
LOGGER.error(e.toString());
}
@ -175,8 +175,13 @@ public class UserManager {
}
public static User getUserInMem(int uid) {
User user = userMap.get(uid);
return user;
// User user = userMap.get(uid);
try {
return getUser(uid,true);
}catch (Exception e){
LOGGER.error("UserManager::getUser null exception"+uid);
}
return null;
}
public static void removeUser(int uid) {
userMap.remove(uid);

View File

@ -297,11 +297,15 @@ public class MailLogic {
}
//发送邮件
public void sendMail(int uid, String title, String content, String reward, int sendTime, int mailEffectiveTime) throws Exception {
User user = UserManager.getUser(uid);
Mail mail = new Mail(uid,title,content,reward,sendTime, mailEffectiveTime,"system",Global.MAIL_TYPE_SYS);
user.getMailManager().addMail(mail);
LOGGER.info("sendMail==>uid={},title={},reward:{}",uid,title,reward);
MessageUtil.sendRedIndication(uid, GlobalsDef.MAIL_RED_TYPE);
try {
User user = UserManager.getUser(uid);
Mail mail = new Mail(uid,title,content,reward,sendTime, mailEffectiveTime,"system",Global.MAIL_TYPE_SYS);
user.getMailManager().addMail(mail);
LOGGER.info("sendMail==>uid={},title={},reward:{}",uid,title,reward);
MessageUtil.sendRedIndication(uid, GlobalsDef.MAIL_RED_TYPE);
}catch (Exception e){
LOGGER.error(e.toString()+"sendMail==>uid={},title={},reward:{}",uid,title,reward);
}
}
/**
*