支持删 RechargeCommodityConfig
parent
31859110b4
commit
af0b9547c5
|
@ -496,7 +496,7 @@ public class BuyGoodsNewLogic {
|
|||
}
|
||||
}else{
|
||||
if(bag.getType() == RechargeType.push.getType() && !bag.isOpen()){
|
||||
user.getPlayerInfoManager().getNewRechargeInfo().removePush((PushWelfareBag) bag);
|
||||
user.getPlayerInfoManager().getNewRechargeInfo().removePush(bag.getModId());
|
||||
return true;
|
||||
}
|
||||
if(bag.getType() == RechargeType.timeLimit.getType()){
|
||||
|
@ -586,7 +586,7 @@ public class BuyGoodsNewLogic {
|
|||
bag.setLastBuyTime(0);
|
||||
bag.setBuyTimes(0);
|
||||
if(bag.getType() == RechargeType.push.getType()){
|
||||
user.getPlayerInfoManager().getNewRechargeInfo().removePush((PushWelfareBag) bag);
|
||||
user.getPlayerInfoManager().getNewRechargeInfo().removePush(bag.getModId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -640,25 +640,70 @@ public class BuyGoodsNewLogic {
|
|||
User user = UserManager.getUser(uid);
|
||||
boolean needChange = refreshWelfareState(user);
|
||||
NewRechargeInfo rechargeInfo = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
Set<Integer> needRemoveIds = new HashSet<>();
|
||||
for(AbstractWelfareBag bag : rechargeInfo.getPerpetualMap().values()){
|
||||
if(bag.isOpen()){
|
||||
giftGoodsInfoList.add(buildGoodsInfo(bag));
|
||||
CommonProto.GiftGoodsInfo giftGoodsInfo = buildGoodsInfo(bag);
|
||||
if (giftGoodsInfo == null) {
|
||||
needRemoveIds.add(bag.getModId());
|
||||
continue;
|
||||
}
|
||||
giftGoodsInfoList.add(giftGoodsInfo);
|
||||
}
|
||||
}
|
||||
if (!needRemoveIds.isEmpty()) {
|
||||
for (Integer needRemoveId : needRemoveIds) {
|
||||
rechargeInfo.removePerpetualMap(needRemoveId);
|
||||
}
|
||||
needRemoveIds.clear();
|
||||
}
|
||||
for(AbstractWelfareBag bag : rechargeInfo.getTimeLimitMap().values()){
|
||||
if(bag.isOpen()){
|
||||
giftGoodsInfoList.add(buildGoodsInfo(bag));
|
||||
CommonProto.GiftGoodsInfo giftGoodsInfo = buildGoodsInfo(bag);
|
||||
if (giftGoodsInfo == null) {
|
||||
needRemoveIds.add(bag.getModId());
|
||||
continue;
|
||||
}
|
||||
giftGoodsInfoList.add(giftGoodsInfo);
|
||||
}
|
||||
}
|
||||
if (!needRemoveIds.isEmpty()) {
|
||||
for (Integer needRemoveId : needRemoveIds) {
|
||||
rechargeInfo.removeTimeLimitMap(needRemoveId);
|
||||
}
|
||||
needRemoveIds.clear();
|
||||
}
|
||||
for(AbstractWelfareBag bag : rechargeInfo.getReceiveMap().values()){
|
||||
if(bag.isOpen()){
|
||||
giftGoodsInfoList.add(buildGoodsInfo(bag));
|
||||
CommonProto.GiftGoodsInfo giftGoodsInfo = buildGoodsInfo(bag);
|
||||
if (giftGoodsInfo == null) {
|
||||
needRemoveIds.add(bag.getModId());
|
||||
continue;
|
||||
}
|
||||
giftGoodsInfoList.add(giftGoodsInfo);
|
||||
}
|
||||
}
|
||||
if (!needRemoveIds.isEmpty()) {
|
||||
for (Integer needRemoveId : needRemoveIds) {
|
||||
rechargeInfo.removeReceiveMap(needRemoveId);
|
||||
}
|
||||
needRemoveIds.clear();
|
||||
}
|
||||
for(AbstractWelfareBag bag : rechargeInfo.getPushMap().values()){
|
||||
if(bag.isOpen()){
|
||||
giftGoodsInfoList.add(buildGoodsInfo(bag));
|
||||
CommonProto.GiftGoodsInfo giftGoodsInfo = buildGoodsInfo(bag);
|
||||
if (giftGoodsInfo == null) {
|
||||
needRemoveIds.add(bag.getModId());
|
||||
continue;
|
||||
}
|
||||
giftGoodsInfoList.add(giftGoodsInfo);
|
||||
}
|
||||
}
|
||||
if (!needRemoveIds.isEmpty()) {
|
||||
for (Integer needRemoveId : needRemoveIds) {
|
||||
rechargeInfo.removePush(needRemoveId);
|
||||
}
|
||||
needRemoveIds.clear();
|
||||
}
|
||||
giftGoodsInfoList.sort((o1, o2) -> {
|
||||
if(o1.getGoodsId() > o2.getGoodsId()){
|
||||
|
@ -770,6 +815,10 @@ public class BuyGoodsNewLogic {
|
|||
}
|
||||
|
||||
public static CommonProto.GiftGoodsInfo buildGoodsInfo(AbstractWelfareBag bag){
|
||||
SRechargeCommodityNewConfig configById = SRechargeCommodityNewConfig.getConfigById(bag.getModId());
|
||||
if (configById == null) {
|
||||
return null;
|
||||
}
|
||||
CommonProto.GiftGoodsInfo.Builder builder = CommonProto.GiftGoodsInfo.newBuilder();
|
||||
builder.setGoodsId(bag.getModId());
|
||||
builder.setBuyTimes(bag.getBuyTimes());
|
||||
|
|
|
@ -204,9 +204,24 @@ public class NewRechargeInfo extends MongoBase {
|
|||
updateString("pushMap."+bag.getModId(),bag);
|
||||
}
|
||||
|
||||
public void removePush(PushWelfareBag bag){
|
||||
pushMap.remove(bag.getModId());
|
||||
removeString(getMongoKey() + ".pushMap."+bag.getModId());
|
||||
public void removePerpetualMap(int modId){
|
||||
perpetualMap.remove(modId);
|
||||
removeString(getMongoKey() + ".perpetualMap."+modId);
|
||||
}
|
||||
|
||||
public void removeTimeLimitMap(int modId){
|
||||
timeLimitMap.remove(modId);
|
||||
removeString(getMongoKey() + ".timeLimitMap."+modId);
|
||||
}
|
||||
|
||||
public void removeReceiveMap(int modId){
|
||||
receiveMap.remove(modId);
|
||||
removeString(getMongoKey() + ".receiveMap."+modId);
|
||||
}
|
||||
|
||||
public void removePush(int modId){
|
||||
pushMap.remove(modId);
|
||||
removeString(getMongoKey() + ".pushMap."+modId);
|
||||
}
|
||||
|
||||
public int getMainLineLost() {
|
||||
|
|
Loading…
Reference in New Issue