【山河社稷图】最低战力通关和首次通关的战斗数据由redis改为数据库储存
parent
c92e5b1b7a
commit
d3c4ea921b
|
@ -5,6 +5,7 @@ import com.ljsd.jieling.db.redis.RedisKey;
|
|||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
|
@ -28,16 +29,29 @@ public class HardStageReportRequsetHandler extends BaseHandler<PlayerInfoProto.H
|
|||
int id = proto.getHardStageId();
|
||||
PlayerInfoProto.HardStageReportResponse.Builder response = PlayerInfoProto.HardStageReportResponse.newBuilder();
|
||||
//首次通关记录
|
||||
ArenaRecord firstPassRecord = RedisUtil.getInstence().get(RedisKey.HARD_STAGE_FIST_PASS, String.valueOf(id),ArenaRecord.class);
|
||||
if(firstPassRecord != null){
|
||||
CommonProto.HardStagePlayerInfo first = CBean2Proto.getHardStagePlayerInfo(firstPassRecord,1,user);
|
||||
ArenaRecord firstPassRecordRedis = RedisUtil.getInstence().get(RedisKey.HARD_STAGE_FIST_PASS, String.valueOf(id),ArenaRecord.class);
|
||||
GlobalSystemControl globalSystemControl = GlobalSystemControl.getGlobalSystemControl();
|
||||
if(firstPassRecordRedis != null){
|
||||
CommonProto.HardStagePlayerInfo first = CBean2Proto.getHardStagePlayerInfo(firstPassRecordRedis,1,user);
|
||||
response.addPlayer(first);
|
||||
}else{
|
||||
ArenaRecord firstPassRecordMongo = globalSystemControl.getHardStageFirstRecord().get(id);
|
||||
if(firstPassRecordMongo!= null){
|
||||
CommonProto.HardStagePlayerInfo first = CBean2Proto.getHardStagePlayerInfo(firstPassRecordMongo,1,user);
|
||||
response.addPlayer(first);
|
||||
}
|
||||
}
|
||||
// 最低战力通关记录记录
|
||||
ArenaRecord minForcePassRecord = RedisUtil.getInstence().get(RedisKey.HARD_STAGE_PASS_MIN_FORCE, String.valueOf(id),ArenaRecord.class);
|
||||
if(minForcePassRecord!=null){
|
||||
CommonProto.HardStagePlayerInfo min = CBean2Proto.getHardStagePlayerInfo(minForcePassRecord,2,user);
|
||||
ArenaRecord minForcePassRecordRedis = RedisUtil.getInstence().get(RedisKey.HARD_STAGE_PASS_MIN_FORCE, String.valueOf(id),ArenaRecord.class);
|
||||
if(minForcePassRecordRedis!=null){
|
||||
CommonProto.HardStagePlayerInfo min = CBean2Proto.getHardStagePlayerInfo(minForcePassRecordRedis,2,user);
|
||||
response.addPlayer(min);
|
||||
}else{
|
||||
ArenaRecord minForcePassRecordMongo = globalSystemControl.getHardStageMinForceRecord().get(id);
|
||||
if(minForcePassRecordMongo!=null){
|
||||
CommonProto.HardStagePlayerInfo min = CBean2Proto.getHardStagePlayerInfo(minForcePassRecordMongo,2,user);
|
||||
response.addPlayer(min);
|
||||
}
|
||||
}
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.HARD_STAGE_REPORT_RESPONSE.getNumber(), response.build(), true);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.ljsd.jieling.logic.activity.event.Poster;
|
|||
import com.ljsd.jieling.logic.activity.event.ShanHeSheJiTuStarEvent;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.FightRecordLogic;
|
||||
import com.ljsd.jieling.logic.fight.FightUtil;
|
||||
|
@ -151,9 +152,11 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
|||
//战斗回放
|
||||
int force = HeroLogic.getInstance().calTeamTotalForce(user, teamId, false);
|
||||
// 首次通关记录
|
||||
ArenaRecord firstPassRecord = RedisUtil.getInstence().get(RedisKey.HARD_STAGE_FIST_PASS, String.valueOf(nodeId), ArenaRecord.class);
|
||||
if (firstPassRecord == null) {
|
||||
//ArenaRecord firstPassRecord = RedisUtil.getInstence().get(RedisKey.HARD_STAGE_FIST_PASS, String.valueOf(nodeId), ArenaRecord.class);
|
||||
GlobalSystemControl globalSystemControl = GlobalSystemControl.getGlobalSystemControl();
|
||||
if (!globalSystemControl.getHardStageFirstRecord().containsKey(nodeId)) {
|
||||
ArenaRecord arenaRecord = new ArenaRecord();
|
||||
arenaRecord.setId(String.valueOf(nodeId));
|
||||
arenaRecord.setCreateTime(TimeUtils.nowInt());
|
||||
arenaRecord.setAttackId(user.getId());
|
||||
arenaRecord.setLevel(user.getPlayerInfoManager().getLevel());
|
||||
|
@ -162,12 +165,16 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
|||
arenaRecord.setHeadFrame(user.getPlayerInfoManager().getHeadFrame());
|
||||
arenaRecord.setFightData(fightData.toByteArray());
|
||||
arenaRecord.setAttackForce(force);
|
||||
RedisUtil.getInstence().set(RedisKey.HARD_STAGE_FIST_PASS, String.valueOf(nodeId), arenaRecord);
|
||||
globalSystemControl.addHardStageFirstRecord(nodeId,arenaRecord);
|
||||
//RedisUtil.getInstence().set(RedisKey.HARD_STAGE_FIST_PASS, String.valueOf(nodeId), arenaRecord);
|
||||
GlobalSystemControl.save(globalSystemControl);
|
||||
}
|
||||
// 最低战力通关记录记录
|
||||
ArenaRecord minForcePassRecord = RedisUtil.getInstence().get(RedisKey.HARD_STAGE_PASS_MIN_FORCE, String.valueOf(nodeId), ArenaRecord.class);
|
||||
//ArenaRecord minForcePassRecord = RedisUtil.getInstence().get(RedisKey.HARD_STAGE_PASS_MIN_FORCE, String.valueOf(nodeId), ArenaRecord.class);
|
||||
ArenaRecord minForcePassRecord = globalSystemControl.getHardStageMinForceRecord().get(nodeId);
|
||||
if (minForcePassRecord == null || force < minForcePassRecord.getAttackForce()) {
|
||||
ArenaRecord arenaRecord = new ArenaRecord();
|
||||
arenaRecord.setId(String.valueOf(nodeId));
|
||||
arenaRecord.setCreateTime(TimeUtils.nowInt());
|
||||
arenaRecord.setAttackId(user.getId());
|
||||
arenaRecord.setLevel(user.getPlayerInfoManager().getLevel());
|
||||
|
@ -176,7 +183,9 @@ public class StartHardStageRequestHandler extends BaseHandler<PlayerInfoProto.Ha
|
|||
arenaRecord.setHeadFrame(user.getPlayerInfoManager().getHeadFrame());
|
||||
arenaRecord.setFightData(fightData.toByteArray());
|
||||
arenaRecord.setAttackForce(force);
|
||||
RedisUtil.getInstence().set(RedisKey.HARD_STAGE_PASS_MIN_FORCE, String.valueOf(nodeId), arenaRecord);
|
||||
//RedisUtil.getInstence().set(RedisKey.HARD_STAGE_PASS_MIN_FORCE, String.valueOf(nodeId), arenaRecord);
|
||||
globalSystemControl.addHardStageMinForceRecord(nodeId,arenaRecord);
|
||||
GlobalSystemControl.save(globalSystemControl);
|
||||
}
|
||||
//排行榜星级
|
||||
int starSum = HardStageLogic.getHardStageStarsSum(user);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.logic.dao.root;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.fight.ArenaRecord;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.dao.Question;
|
||||
|
@ -23,6 +24,11 @@ public class GlobalSystemControl {
|
|||
private int questId;//本服开启的问卷id
|
||||
private HashMap<Integer,Integer> activityOpenValue= new HashMap<>();
|
||||
|
||||
//山河社稷图首次通关记录
|
||||
private Map<Integer, ArenaRecord> hardStageFirstRecord = new HashMap<>();
|
||||
//山河社稷图最低通关记录
|
||||
private Map<Integer, ArenaRecord> hardStageMinForceRecord = new HashMap<>();
|
||||
|
||||
@Transient
|
||||
private boolean dirty = false;
|
||||
|
||||
|
@ -112,4 +118,22 @@ public class GlobalSystemControl {
|
|||
return stringsList;
|
||||
}
|
||||
|
||||
|
||||
public Map<Integer, ArenaRecord> getHardStageFirstRecord() {
|
||||
return hardStageFirstRecord;
|
||||
}
|
||||
public void addHardStageFirstRecord(int nodeId,ArenaRecord record){
|
||||
this.dirty = true;
|
||||
hardStageFirstRecord.put(nodeId ,record);
|
||||
}
|
||||
|
||||
public Map<Integer, ArenaRecord> getHardStageMinForceRecord() {
|
||||
return hardStageMinForceRecord;
|
||||
}
|
||||
|
||||
public void addHardStageMinForceRecord(int nodeId,ArenaRecord record){
|
||||
this.dirty = true;
|
||||
hardStageMinForceRecord.put(nodeId ,record);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue