Revert "推送礼包优化"

This reverts commit 7ed896b78c.
back_recharge
lvxinran 2021-07-05 11:26:24 +08:00
parent cc6c06f0a7
commit 1ed8030f32
4 changed files with 33 additions and 34 deletions

View File

@ -460,6 +460,10 @@ public class BuyGoodsNewLogic {
result = true;
}
}else{
if(bag.getType() == RechargeType.push.getType() && !bag.isOpen()){
user.getPlayerInfoManager().getNewRechargeInfo().removePush((PushWelfareBag) bag);
return true;
}
if(bag.getType() == RechargeType.timeLimit.getType()){
//活动类型特殊处理
for(String[] s : configById.getCondition()){
@ -539,15 +543,6 @@ public class BuyGoodsNewLogic {
return bag;
}
/**
* setPush
*/
public static void setInitPushInfo(PushWelfareBag bag,SRechargeCommodityNewConfig config){
bag.setStartTime(System.currentTimeMillis());
bag.setEndTime(System.currentTimeMillis() + bag.getTime() * TimeUtils.HOUR);
bag.setOpen(true);
}
/**
*
*/
@ -556,7 +551,7 @@ public class BuyGoodsNewLogic {
bag.setLastBuyTime(0);
bag.setBuyTimes(0);
if(bag.getType() == RechargeType.push.getType()){
clearPushBag((PushWelfareBag) bag);
user.getPlayerInfoManager().getNewRechargeInfo().removePush((PushWelfareBag) bag);
}
}
@ -886,26 +881,36 @@ public class BuyGoodsNewLogic {
}else{
info.getTempLimitMap().put(bagId,num);
}
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(bagId);
if(info.getPushMap().get(bagId) != null){
if(isFiveStarBag(bagId) && info.getPushMap().get(bagId) != null){
AbstractWelfareBag bag = info.getPushMap().get(bagId);
setInitPushInfo((PushWelfareBag) bag,config);
if(isFiveStarBag(bagId)){
bag.setLimit((bag.getLimit()+num)>info.FIVESTARLIMIT?info.FIVESTARLIMIT:(bag.getLimit()+num));
}
bag.setLimit((bag.getLimit()+num)>info.FIVESTARLIMIT?info.FIVESTARLIMIT:(bag.getLimit()+num));
bag.setStartTime(System.currentTimeMillis());
bag.setEndTime(bag.getStartTime() + getTime(bag) * TimeUtils.HOUR);
}else{
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(bagId);
AbstractWelfareBag bag = initUnitWF(user,config);
if(isFiveStarBag(bagId)){
bag.setLimit(num>info.FIVESTARLIMIT?info.FIVESTARLIMIT:num);
if(num != 0 && num+hasOpen > info.FIVESTARLIMIT){
bag.setLimit(info.FIVESTARLIMIT-hasOpen);
}else{
bag.setLimit(num);
}
}
return true;
}
/**
*
*
* @param bag
* @return
*/
private static void clearPushBag(PushWelfareBag bag){
bag.clear();
private static int getTime(AbstractWelfareBag bag){
int i = 2;
for(String[] s : bag.getCondition()){
if(s[0].equals("6")){
i = Integer.parseInt(s[1]);
break;
}
}
return i;
}
}

View File

@ -184,6 +184,11 @@ 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 int getMainLineLost() {
return mainLineLost;
}

View File

@ -35,9 +35,6 @@ public class AbstractWelfareBag extends MongoBase{
setModId(config.getId());
setType(config.getOtype());
setLimit(config.getLimit());
if(config.getOtype() == 4){
setLimit(1);
}
setTimeType(config.getTime());
setDailyUpdate(config.getDailyUpdate());
setContinueDays(config.getContiueDays());

View File

@ -27,20 +27,12 @@ public class PushWelfareBag extends AbstractWelfareBag {
public boolean buy() {
setBuyTimes(getBuyTimes()+1);
if(getLimit()<=getBuyTimes()){
clear();
setOpen(false);
}
return true;
}
public void clear(){
setOpen(false);
setLimit(1);
setBuyTimes(0);
setStartTime(0);
setEndTime(0);
}
public int getTime(){
private int getTime(){
int i = 2;
for(String[] s : getCondition()){
if(s[0].equals("6")){