From 0bc42cbe76302066c4332801ab8b107d7acfc42a Mon Sep 17 00:00:00 2001 From: zhangshanxue Date: Sat, 28 Dec 2019 15:38:49 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90ID1005331=E3=80=91=E3=80=90=E6=98=9F?= =?UTF-8?q?=E7=BA=A7=E6=88=90=E9=95=BF=E7=A4=BC=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jieling/logic/store/BuyGoodsLogic.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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;