parent
cc6c06f0a7
commit
1ed8030f32
|
|
@ -460,6 +460,10 @@ public class BuyGoodsNewLogic {
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
if(bag.getType() == RechargeType.push.getType() && !bag.isOpen()){
|
||||||
|
user.getPlayerInfoManager().getNewRechargeInfo().removePush((PushWelfareBag) bag);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if(bag.getType() == RechargeType.timeLimit.getType()){
|
if(bag.getType() == RechargeType.timeLimit.getType()){
|
||||||
//活动类型特殊处理
|
//活动类型特殊处理
|
||||||
for(String[] s : configById.getCondition()){
|
for(String[] s : configById.getCondition()){
|
||||||
|
|
@ -539,15 +543,6 @@ public class BuyGoodsNewLogic {
|
||||||
return bag;
|
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.setLastBuyTime(0);
|
||||||
bag.setBuyTimes(0);
|
bag.setBuyTimes(0);
|
||||||
if(bag.getType() == RechargeType.push.getType()){
|
if(bag.getType() == RechargeType.push.getType()){
|
||||||
clearPushBag((PushWelfareBag) bag);
|
user.getPlayerInfoManager().getNewRechargeInfo().removePush((PushWelfareBag) bag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -886,26 +881,36 @@ public class BuyGoodsNewLogic {
|
||||||
}else{
|
}else{
|
||||||
info.getTempLimitMap().put(bagId,num);
|
info.getTempLimitMap().put(bagId,num);
|
||||||
}
|
}
|
||||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(bagId);
|
if(isFiveStarBag(bagId) && info.getPushMap().get(bagId) != null){
|
||||||
if(info.getPushMap().get(bagId) != null){
|
|
||||||
AbstractWelfareBag bag = info.getPushMap().get(bagId);
|
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{
|
}else{
|
||||||
|
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(bagId);
|
||||||
AbstractWelfareBag bag = initUnitWF(user,config);
|
AbstractWelfareBag bag = initUnitWF(user,config);
|
||||||
if(isFiveStarBag(bagId)){
|
if(num != 0 && num+hasOpen > info.FIVESTARLIMIT){
|
||||||
bag.setLimit(num>info.FIVESTARLIMIT?info.FIVESTARLIMIT:num);
|
bag.setLimit(info.FIVESTARLIMIT-hasOpen);
|
||||||
|
}else{
|
||||||
|
bag.setLimit(num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消除推送礼包
|
* 推送礼包的结束时间
|
||||||
|
* @param bag
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
private static void clearPushBag(PushWelfareBag bag){
|
private static int getTime(AbstractWelfareBag bag){
|
||||||
bag.clear();
|
int i = 2;
|
||||||
|
for(String[] s : bag.getCondition()){
|
||||||
|
if(s[0].equals("6")){
|
||||||
|
i = Integer.parseInt(s[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,11 @@ public class NewRechargeInfo extends MongoBase {
|
||||||
updateString("pushMap."+bag.getModId(),bag);
|
updateString("pushMap."+bag.getModId(),bag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removePush(PushWelfareBag bag){
|
||||||
|
pushMap.remove(bag.getModId());
|
||||||
|
removeString(getMongoKey() + ".pushMap."+bag.getModId());
|
||||||
|
}
|
||||||
|
|
||||||
public int getMainLineLost() {
|
public int getMainLineLost() {
|
||||||
return mainLineLost;
|
return mainLineLost;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,6 @@ public class AbstractWelfareBag extends MongoBase{
|
||||||
setModId(config.getId());
|
setModId(config.getId());
|
||||||
setType(config.getOtype());
|
setType(config.getOtype());
|
||||||
setLimit(config.getLimit());
|
setLimit(config.getLimit());
|
||||||
if(config.getOtype() == 4){
|
|
||||||
setLimit(1);
|
|
||||||
}
|
|
||||||
setTimeType(config.getTime());
|
setTimeType(config.getTime());
|
||||||
setDailyUpdate(config.getDailyUpdate());
|
setDailyUpdate(config.getDailyUpdate());
|
||||||
setContinueDays(config.getContiueDays());
|
setContinueDays(config.getContiueDays());
|
||||||
|
|
|
||||||
|
|
@ -27,20 +27,12 @@ public class PushWelfareBag extends AbstractWelfareBag {
|
||||||
public boolean buy() {
|
public boolean buy() {
|
||||||
setBuyTimes(getBuyTimes()+1);
|
setBuyTimes(getBuyTimes()+1);
|
||||||
if(getLimit()<=getBuyTimes()){
|
if(getLimit()<=getBuyTimes()){
|
||||||
clear();
|
setOpen(false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear(){
|
private int getTime(){
|
||||||
setOpen(false);
|
|
||||||
setLimit(1);
|
|
||||||
setBuyTimes(0);
|
|
||||||
setStartTime(0);
|
|
||||||
setEndTime(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTime(){
|
|
||||||
int i = 2;
|
int i = 2;
|
||||||
for(String[] s : getCondition()){
|
for(String[] s : getCondition()){
|
||||||
if(s[0].equals("6")){
|
if(s[0].equals("6")){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue