diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsLogic.java index 30d8a4c48..8fa2588f5 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsLogic.java @@ -230,7 +230,7 @@ public class BuyGoodsLogic { int tempvalue = discountType[1]; if(temptype == 4){ - int dytime = rechargeInfo.getDyGoodsCanBuyTimes().getOrDefault(tempvalue,0)-1; + int dytime = rechargeInfo.getDyGoodsCanBuyTimes().getOrDefault(goodsId,0)-1; if(dytime <=0){ if (rechargeInfo.getTypeBagMap().containsKey(tempvalue)){ rechargeInfo.removeTypeBagMap(tempvalue); @@ -239,7 +239,7 @@ public class BuyGoodsLogic { rechargeInfo.getCacheSendedTypes().remove(tempvalue); } }else { - rechargeInfo.putDyGoodsCanBuyTimes(dytime,dytime); + rechargeInfo.putDyGoodsCanBuyTimes(goodsId,dytime); } List goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size()); @@ -393,7 +393,7 @@ public class BuyGoodsLogic { int addtime = discountType[2]; int diffHour = (int) ((now - startTime) / 3600 / 1000); if (diffHour >= addtime) { - rechargeInfo.removeDyGoodsCanBuyTimes(value); + rechargeInfo.removeDyGoodsCanBuyTimes(goodsId); continue; } endTime = startTime + addtime * 3600 * 1000; @@ -411,7 +411,7 @@ public class BuyGoodsLogic { }else { rechargeInfo.getCacheSendedTypes().put(value, startTime); } - dybuytime = rechargeInfo.getDyGoodsCanBuyTimes().getOrDefault(value,0); + dybuytime = rechargeInfo.getDyGoodsCanBuyTimes().getOrDefault(goodsId,0); } }else{ @@ -437,8 +437,7 @@ public class BuyGoodsLogic { } } goodsOrder.put(sRechargeCommodityConfig.getType(),order*10000 + goodsId); - giftGoodsInfoMap.put(goodsId,CommonProto.GiftGoodsInfo.newBuilder().setGoodsId(goodsId).setStartTime((int)(startTime/1000)).setBuyTimes(buyTimes).setEndTime((int)(endTime/1000)) - .setDynamicBuyTimes(dybuytime).build()); + giftGoodsInfoMap.put(goodsId,CommonProto.GiftGoodsInfo.newBuilder().setGoodsId(goodsId).setStartTime((int)(startTime/1000)).setBuyTimes(buyTimes).setEndTime((int)(endTime/1000)).build()); boolean isNew = rechargeInfo.addNewSendId(goodsId); if(isNew){ needChange = true; @@ -449,7 +448,12 @@ public class BuyGoodsLogic { if(isNew){ needChange = true; } - giftGoodsInfoList.add(CommonProto.GiftGoodsInfo.newBuilder().setGoodsId(goodsId).setBuyTimes(buyTimes).setStartTime((int)(startTime/1000)).setEndTime((int)(endTime/1000)).build()); + CommonProto.GiftGoodsInfo.Builder builder = CommonProto.GiftGoodsInfo.newBuilder(); + builder.setGoodsId(goodsId).setStartTime((int)(startTime/1000)).setBuyTimes(buyTimes).setEndTime((int)(endTime/1000)); + if(dybuytime!=-1){ + builder.setDynamicBuyTimes(dybuytime); + } + giftGoodsInfoList.add(builder.build()); } giftGoodsInfoList.addAll(giftGoodsInfoMap.values()); return needChange;