BUG 【ID1006263】 【五星成长礼】在碎片合成时,获得五星猎妖师,偶尔没有前往的弹窗
parent
a7ed154936
commit
267f621cc0
|
@ -4,6 +4,7 @@ import com.google.protobuf.GeneratedMessage;
|
|||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
|
@ -13,11 +14,12 @@ import java.util.*;
|
|||
/**
|
||||
* 伪事务
|
||||
*/
|
||||
|
||||
public class SimpleTransaction {
|
||||
//当前过程的session
|
||||
private ISession session;
|
||||
private List<TransTask> tasks = new LinkedList<>();
|
||||
private Map<Integer, List<GeneratedMessage>> sendCacheMap = new HashMap<>();
|
||||
private Map<Integer, LinkedList<GeneratedMessage>> sendCacheMap = new HashMap<>();
|
||||
private static final Map<Integer, MessageUtil.CombinePolicy> combineMsgId = new HashMap<>();
|
||||
|
||||
static {
|
||||
|
@ -45,7 +47,35 @@ public class SimpleTransaction {
|
|||
combineMsgId.put(MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, (MessageUtil.CombinePolicy< PlayerInfoProto.AllGiftGoodsIndication>) list -> {
|
||||
List<PlayerInfoProto.AllGiftGoodsIndication> combineList = new LinkedList<>();
|
||||
if(list.size()>0){
|
||||
combineList.add(list.get(list.size()-1));
|
||||
if(list.size()>1){
|
||||
//修复连续获得多个英雄 前端无法处理问题
|
||||
HashMap<Integer, Integer> giftId2startTimeMap = new HashMap<>();
|
||||
list.getFirst().getGiftGoodsInfoList().forEach(giftGoodsInfo -> {
|
||||
if(giftGoodsInfo.getStartTime()!=0){
|
||||
giftId2startTimeMap.put(giftGoodsInfo.getGoodsId(),giftGoodsInfo.getStartTime());
|
||||
}
|
||||
});
|
||||
|
||||
PlayerInfoProto.AllGiftGoodsIndication.Builder build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder();
|
||||
list.getLast().getGiftGoodsInfoList().forEach(giftGoodsInfo -> {
|
||||
if(giftId2startTimeMap.containsKey(giftGoodsInfo.getGoodsId())){
|
||||
CommonProto.GiftGoodsInfo.Builder builder = CommonProto.GiftGoodsInfo.newBuilder();
|
||||
builder.setStartTime(giftId2startTimeMap.get(giftGoodsInfo.getGoodsId()));
|
||||
builder.setBuyTimes(giftGoodsInfo.getBuyTimes());
|
||||
builder.setEndTime(giftGoodsInfo.getEndTime());
|
||||
builder.setGoodsId(giftGoodsInfo.getGoodsId());
|
||||
builder.setDynamicBuyTimes(giftGoodsInfo.getDynamicBuyTimes());
|
||||
build.addGiftGoodsInfo(builder);
|
||||
}else {
|
||||
build.addGiftGoodsInfo(giftGoodsInfo);
|
||||
}
|
||||
});
|
||||
|
||||
combineList.add(build.build());
|
||||
}else {
|
||||
combineList.add(list.getLast());
|
||||
}
|
||||
|
||||
}
|
||||
return combineList;
|
||||
});
|
||||
|
@ -61,7 +91,7 @@ public class SimpleTransaction {
|
|||
|
||||
public void dealWhileCommit(TransTask transTask) {
|
||||
if (transTask instanceof SendTask && combineMsgId.keySet().contains(((SendTask) transTask).getMsgId())) {
|
||||
List<GeneratedMessage> linkedList = sendCacheMap.getOrDefault(((SendTask) transTask).getMsgId(), null);
|
||||
LinkedList<GeneratedMessage> linkedList = sendCacheMap.getOrDefault(((SendTask) transTask).getMsgId(), null);
|
||||
if (null == linkedList) {
|
||||
linkedList = new LinkedList<>();
|
||||
sendCacheMap.put(((SendTask) transTask).getMsgId(), linkedList);
|
||||
|
|
|
@ -25,10 +25,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class MessageUtil {
|
||||
|
||||
|
@ -343,7 +340,7 @@ public class MessageUtil {
|
|||
* @param list 移除被合并项
|
||||
* @return 返回一个合并协议
|
||||
*/
|
||||
List<T> combine(List<T> list);
|
||||
List<T> combine(LinkedList<T> list);
|
||||
}
|
||||
|
||||
public static void checkAndSendMsg(){
|
||||
|
|
Loading…
Reference in New Issue