Merge branch 'master_test_gn_mcz' of http://60.1.1.230/backend/jieling_server into master_test_gn_mcz
# Conflicts: # serverlogic/src/main/java/com/ljsd/jieling/logic/store/BuyGoodsNewLogic.java # serverlogic/src/main/java/com/ljsd/jieling/logic/store/newRechargeInfo/NewRechargeInfo.javaback_recharge
commit
54a3149de6
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.ljsd.jieling.db.mongo;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.ljsd.jieling.globals.GlobalItemType;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.RechargeType;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.*;
|
||||||
|
import com.mongodb.BasicDBObject;
|
||||||
|
import config.SRechargeCommodityNewConfig;
|
||||||
|
import manager.STableManager;
|
||||||
|
import org.bson.json.JsonWriterSettings;
|
||||||
|
import org.springframework.core.convert.converter.Converter;
|
||||||
|
import org.springframework.data.convert.ReadingConverter;
|
||||||
|
|
||||||
|
@ReadingConverter
|
||||||
|
public class MongoWelfareBagConverter implements Converter<BasicDBObject, PerpetualWelfareBag> {
|
||||||
|
// private static JsonWriterSettings jsonWriterSettings = new JsonWriterSettings();
|
||||||
|
Gson gson = new Gson();
|
||||||
|
@Override
|
||||||
|
public PerpetualWelfareBag convert(BasicDBObject source) {
|
||||||
|
SRechargeCommodityNewConfig config = STableManager.getConfig(SRechargeCommodityNewConfig.class).get(source.getInt("modId"));
|
||||||
|
Class<? extends PerpetualWelfareBag> target = PerpetualWelfareBag.class;
|
||||||
|
if(config.getOtype() == RechargeType.perpetual.getType()){
|
||||||
|
target = PerpetualWelfareBag.class;
|
||||||
|
}
|
||||||
|
String s = gson.toJson(source);
|
||||||
|
// String realJson = source.toJson(jsonWriterSettinsgs);
|
||||||
|
PerpetualWelfareBag bag = JSON.parseObject(s,target);
|
||||||
|
return bag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.ljsd.jieling.db.mongo.core;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.ljsd.jieling.globals.GlobalItemType;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.RechargeType;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.*;
|
||||||
|
import com.mongodb.BasicDBObject;
|
||||||
|
import config.SRechargeCommodityNewConfig;
|
||||||
|
import manager.STableManager;
|
||||||
|
import org.bson.json.JsonWriterSettings;
|
||||||
|
import org.springframework.core.convert.converter.Converter;
|
||||||
|
|
||||||
|
public class MongoWelfareBagConverter implements Converter<BasicDBObject, AbstractWelfareBag> {
|
||||||
|
private static JsonWriterSettings jsonWriterSettings = new JsonWriterSettings();
|
||||||
|
@Override
|
||||||
|
public AbstractWelfareBag convert(BasicDBObject source) {
|
||||||
|
SRechargeCommodityNewConfig config = STableManager.getConfig(SRechargeCommodityNewConfig.class).get(source.getInt("modId"));
|
||||||
|
Class<? extends AbstractWelfareBag> target = AbstractWelfareBag.class;
|
||||||
|
if(config.getOtype() == RechargeType.perpetual.getType()){
|
||||||
|
target = PerpetualWelfareBag.class;
|
||||||
|
}else if(config.getOtype() == RechargeType.timeLimit.getType()){
|
||||||
|
target = TimeLimitWelfareBag.class;
|
||||||
|
}else if(config.getOtype() == RechargeType.receive.getType()){
|
||||||
|
target = ReceiveWelfareBag.class;
|
||||||
|
}else if(config.getOtype() == RechargeType.push.getType()){
|
||||||
|
target = PushWelfareBag.class;
|
||||||
|
}
|
||||||
|
String realJson = source.toJson(jsonWriterSettings);
|
||||||
|
AbstractWelfareBag bag = JSON.parseObject(realJson,target);
|
||||||
|
return bag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -32,6 +32,7 @@ import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||||
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
||||||
import com.ljsd.jieling.logic.store.newRechargeInfo.RechargeType;
|
import com.ljsd.jieling.logic.store.newRechargeInfo.RechargeType;
|
||||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.*;
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.*;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.RechargeHandler;
|
||||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.thrift.idl.Result;
|
import com.ljsd.jieling.thrift.idl.Result;
|
||||||
|
|
@ -57,71 +58,74 @@ public class BuyGoodsNewLogic {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(BuyGoodsNewLogic.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(BuyGoodsNewLogic.class);
|
||||||
|
|
||||||
|
|
||||||
|
public static RechargeHandler getRechargeHandler(int type){
|
||||||
|
return RechargeType.getHandler(type);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录刷新礼包
|
* 登录刷新礼包
|
||||||
*/
|
*/
|
||||||
public static boolean refreshWelfareState(User user){
|
public static boolean refreshWelfareState(User user) throws Exception {
|
||||||
boolean needChange = false;
|
boolean needChange = false;
|
||||||
List<AbstractWelfareBag> pAddList = new ArrayList<>();
|
List<AbstractWelfareBag> pAddList = new ArrayList<>();
|
||||||
List<Integer> garbageList = new ArrayList<>();
|
|
||||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||||
if(info == null){
|
if(info == null){
|
||||||
info = new NewRechargeInfo();
|
info = new NewRechargeInfo();
|
||||||
user.getPlayerInfoManager().setNewRechargeInfo(info);
|
user.getPlayerInfoManager().setNewRechargeInfo(info);
|
||||||
}
|
}
|
||||||
for(Map.Entry<Integer,SRechargeCommodityNewConfig> entry : SRechargeCommodityNewConfig.configMap.entrySet()){
|
for(Map.Entry<Integer,SRechargeCommodityNewConfig> entry : SRechargeCommodityNewConfig.configMap.entrySet()){
|
||||||
if(entry.getValue().getOnSaleRule().equals("") || entry.getValue().getOtype() == 0){
|
//<<<<<<< HEAD
|
||||||
continue;
|
// if(entry.getValue().getOnSaleRule().equals("") || entry.getValue().getOtype() == 0){
|
||||||
}
|
// continue;
|
||||||
Map<Integer, PerpetualWelfareBag> perpetualWelfareBagMap = info.getPerpetualMap();
|
// }
|
||||||
Map<Integer, TimeLimitWelfareBag> timeLimitWelfareBagMap = info.getTimeLimitMap();
|
// Map<Integer, PerpetualWelfareBag> perpetualWelfareBagMap = info.getPerpetualMap();
|
||||||
Map<Integer, ReceiveWelfareBag> receiveWelfareBagMap = info.getReceiveMap();
|
// Map<Integer, TimeLimitWelfareBag> timeLimitWelfareBagMap = info.getTimeLimitMap();
|
||||||
Map<Integer, PushWelfareBag> pushWelfareBagMap = info.getPushMap();
|
// Map<Integer, ReceiveWelfareBag> receiveWelfareBagMap = info.getReceiveMap();
|
||||||
if(perpetualWelfareBagMap.containsKey(entry.getKey())){
|
// Map<Integer, PushWelfareBag> pushWelfareBagMap = info.getPushMap();
|
||||||
if(refreshUnitWF(perpetualWelfareBagMap.get(entry.getKey()),garbageList,user) && !needChange){
|
// if(perpetualWelfareBagMap.containsKey(entry.getKey())){
|
||||||
needChange = true;
|
// if(refreshUnitWF(perpetualWelfareBagMap.get(entry.getKey()),garbageList,user) && !needChange){
|
||||||
|
// needChange = true;
|
||||||
|
// }
|
||||||
|
// }else if(timeLimitWelfareBagMap.containsKey(entry.getKey())){
|
||||||
|
// if(refreshUnitWF(timeLimitWelfareBagMap.get(entry.getKey()),garbageList,user) && !needChange){
|
||||||
|
// needChange = true;
|
||||||
|
// }
|
||||||
|
// }else if(receiveWelfareBagMap.containsKey(entry.getKey())){
|
||||||
|
// if(refreshUnitWF(receiveWelfareBagMap.get(entry.getKey()),garbageList,user) && !needChange){
|
||||||
|
// needChange = true;
|
||||||
|
// }
|
||||||
|
// }else if(pushWelfareBagMap.containsKey(entry.getKey())){
|
||||||
|
// if(refreshUnitWF(pushWelfareBagMap.get(entry.getKey()),garbageList,user) && !needChange){
|
||||||
|
// needChange = true;
|
||||||
|
// }
|
||||||
|
// }else if(info.getGarbage().contains(entry.getKey())){
|
||||||
|
//=======
|
||||||
|
|
||||||
|
//获取处理类
|
||||||
|
RechargeHandler rechargeHandler = getRechargeHandler(entry.getValue().getOtype());
|
||||||
|
|
||||||
|
//判断对应的Map是否已经有了信息
|
||||||
|
if(rechargeHandler.rechargeIsInBag(user,entry.getKey())){
|
||||||
|
boolean refreshStatus = rechargeHandler.refreshStatus(user,entry.getKey());
|
||||||
|
if(!needChange) {
|
||||||
|
needChange = refreshStatus;
|
||||||
}
|
}
|
||||||
}else if(timeLimitWelfareBagMap.containsKey(entry.getKey())){
|
|
||||||
if(refreshUnitWF(timeLimitWelfareBagMap.get(entry.getKey()),garbageList,user) && !needChange){
|
|
||||||
needChange = true;
|
|
||||||
}
|
|
||||||
}else if(receiveWelfareBagMap.containsKey(entry.getKey())){
|
|
||||||
if(refreshUnitWF(receiveWelfareBagMap.get(entry.getKey()),garbageList,user) && !needChange){
|
|
||||||
needChange = true;
|
|
||||||
}
|
|
||||||
}else if(pushWelfareBagMap.containsKey(entry.getKey())){
|
|
||||||
if(refreshUnitWF(pushWelfareBagMap.get(entry.getKey()),garbageList,user) && !needChange){
|
|
||||||
needChange = true;
|
|
||||||
}
|
|
||||||
}else if(info.getGarbage().contains(entry.getKey())){
|
|
||||||
continue;
|
|
||||||
}else{
|
}else{
|
||||||
AbstractWelfareBag bag = initUnitWF(user,entry.getValue());
|
//没有的话新初始化信息
|
||||||
|
AbstractWelfareBag bag = rechargeHandler.initUnitWF(user, entry.getValue());
|
||||||
pAddList.add(bag);
|
pAddList.add(bag);
|
||||||
if(refreshUnitWF(bag,garbageList,user) && !needChange){
|
if(refreshUnitWF(bag,user) && !needChange){
|
||||||
needChange = true;
|
needChange = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//添加新增礼包
|
//添加新增礼包
|
||||||
for(AbstractWelfareBag bag : pAddList){
|
for(AbstractWelfareBag bag : pAddList){
|
||||||
if(bag.getType() == RechargeType.perpetual.getType()){
|
int type = bag.getType();
|
||||||
info.addPerpetual((PerpetualWelfareBag) bag);
|
RechargeHandler rechargeHandler = getRechargeHandler(type);
|
||||||
}else if(bag.getType() == RechargeType.timeLimit.getType()){
|
|
||||||
info.addTimeLimit((TimeLimitWelfareBag) bag);
|
rechargeHandler.addNew(user,bag);
|
||||||
}else if(bag.getType() == RechargeType.receive.getType()){
|
|
||||||
info.addReceive((ReceiveWelfareBag)bag);
|
|
||||||
}else if(bag.getType() == RechargeType.push.getType()){
|
|
||||||
info.addPush((PushWelfareBag)bag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(garbageList.size()>0){
|
|
||||||
//添加新垃圾礼包
|
|
||||||
info.addGarbage(garbageList);
|
|
||||||
//缓存删除垃圾礼包
|
|
||||||
for(Integer i : garbageList){
|
|
||||||
info.getTimeLimitMap().remove(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return needChange;
|
return needChange;
|
||||||
}
|
}
|
||||||
|
|
@ -174,7 +178,9 @@ public class BuyGoodsNewLogic {
|
||||||
return resultRes;
|
return resultRes;
|
||||||
}
|
}
|
||||||
goodsId = config.getId();
|
goodsId = config.getId();
|
||||||
|
if(goodsId == 507){
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
double priceTemp =config.getPrice();
|
double priceTemp =config.getPrice();
|
||||||
int cfgType = SSpecialConfig.getIntegerValue(SSpecialConfig.EXCHANGE_FORCE_TYPE);
|
int cfgType = SSpecialConfig.getIntegerValue(SSpecialConfig.EXCHANGE_FORCE_TYPE);
|
||||||
double price = priceTemp==0?0: SExchangeRate.doubleIntegerHashMap.get(cfgType).get((int)priceTemp);
|
double price = priceTemp==0?0: SExchangeRate.doubleIntegerHashMap.get(cfgType).get((int)priceTemp);
|
||||||
|
|
@ -185,15 +191,17 @@ public class BuyGoodsNewLogic {
|
||||||
User user = UserManager.getUser(uid);
|
User user = UserManager.getUser(uid);
|
||||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||||
AbstractWelfareBag bag = null;
|
AbstractWelfareBag bag = null;
|
||||||
if(config.getOtype() == RechargeType.perpetual.getType()){
|
RechargeHandler rechargeHandler = getRechargeHandler(config.getOtype());
|
||||||
bag = info.getPerpetualMap().get(goodsId);
|
// if(config.getOtype() == RechargeType.perpetual.getType()){
|
||||||
}else if(config.getOtype() == RechargeType.timeLimit.getType()){
|
// bag = info.getPerpetualMap().get(goodsId);
|
||||||
bag = info.getTimeLimitMap().get(goodsId);
|
// }else if(config.getOtype() == RechargeType.timeLimit.getType()){
|
||||||
}else if(config.getOtype() == RechargeType.receive.getType()){
|
// bag = info.getTimeLimitMap().get(goodsId);
|
||||||
bag = info.getReceiveMap().get(goodsId);
|
// }else if(config.getOtype() == RechargeType.receive.getType()){
|
||||||
}else if(config.getOtype() == RechargeType.push.getType()){
|
// bag = info.getReceiveMap().get(goodsId);
|
||||||
bag = info.getPushMap().get(goodsId);
|
// }else if(config.getOtype() == RechargeType.push.getType()){
|
||||||
}
|
// bag = info.getPushMap().get(goodsId);
|
||||||
|
// }
|
||||||
|
bag = rechargeHandler.getRechargeMap(user).get(goodsId);
|
||||||
String rewardStr="";
|
String rewardStr="";
|
||||||
if(bag == null || !bag.buy()){
|
if(bag == null || !bag.buy()){
|
||||||
LOGGER.error("购买失败!bag是否为空:{}",bag == null);
|
LOGGER.error("购买失败!bag是否为空:{}",bag == null);
|
||||||
|
|
@ -230,7 +238,7 @@ public class BuyGoodsNewLogic {
|
||||||
notifyPaySuccessFul(uid,goodsId,amount != -999);
|
notifyPaySuccessFul(uid,goodsId,amount != -999);
|
||||||
// Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.RECHARGE_BUY.getType(),goodsId));
|
// Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.RECHARGE_BUY.getType(),goodsId));
|
||||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||||
sendGiftGooodsIndication(uid);
|
sendGiftGoodsWithoutJudge(uid);
|
||||||
onChargeSuccess(user,price,0,orderId,cfgType);//充值成功上报
|
onChargeSuccess(user,price,0,orderId,cfgType);//充值成功上报
|
||||||
Map<Integer, Integer> mapReward = ItemUtil.arrayToMap(config.getBaseReward());
|
Map<Integer, Integer> mapReward = ItemUtil.arrayToMap(config.getBaseReward());
|
||||||
if(price>0){
|
if(price>0){
|
||||||
|
|
@ -263,9 +271,19 @@ public class BuyGoodsNewLogic {
|
||||||
|
|
||||||
public static void sendGiftGooodsIndication(int uid) throws Exception {
|
public static void sendGiftGooodsIndication(int uid) throws Exception {
|
||||||
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
|
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
|
||||||
boolean change = getGoodsBagInfo(uid, goodsBagInfo);
|
boolean needChange = getGoodsBagInfo(uid, goodsBagInfo);
|
||||||
ISession session = OnlineUserManager.getSessionByUid(uid);
|
ISession session = OnlineUserManager.getSessionByUid(uid);
|
||||||
if(session!=null && change){
|
if(session!=null && needChange){
|
||||||
|
PlayerInfoProto.AllGiftGoodsIndication build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
|
||||||
|
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE,build,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendGiftGoodsWithoutJudge(int uid) throws Exception {
|
||||||
|
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
|
||||||
|
getGoodsBagInfo(uid, goodsBagInfo);
|
||||||
|
ISession session = OnlineUserManager.getSessionByUid(uid);
|
||||||
|
if(session!=null){
|
||||||
PlayerInfoProto.AllGiftGoodsIndication build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
|
PlayerInfoProto.AllGiftGoodsIndication build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
|
||||||
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE,build,true);
|
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE,build,true);
|
||||||
}
|
}
|
||||||
|
|
@ -359,8 +377,16 @@ public class BuyGoodsNewLogic {
|
||||||
.setHadBuy(user.getPlayerInfoManager().getHadBuyTreasure()).setLevel(user.getPlayerInfoManager().getTreasureLevel()).build();
|
.setHadBuy(user.getPlayerInfoManager().getHadBuyTreasure()).setLevel(user.getPlayerInfoManager().getTreasureLevel()).build();
|
||||||
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(user.getId()),1,MessageTypeProto.MessageType.TREASURE_LEVELUP_INDICATION_VALUE,indication,true);
|
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(user.getId()),1,MessageTypeProto.MessageType.TREASURE_LEVELUP_INDICATION_VALUE,indication,true);
|
||||||
}
|
}
|
||||||
String title = SErrorCodeEerverConfig.getMsgById(config.getMail()[0]);
|
String title = "";
|
||||||
String content = SErrorCodeEerverConfig.getMsgById(config.getMail()[1]);
|
String content ="";
|
||||||
|
int titleId = (config.getMail()==null || config.getMail().length<1)?-1:config.getMail()[0];
|
||||||
|
int contentId = (config.getMail()==null || config.getMail().length<1)?-1:config.getMail()[1];
|
||||||
|
if(titleId != -1){
|
||||||
|
title = SErrorCodeEerverConfig.getMsgById(titleId);
|
||||||
|
}
|
||||||
|
if(contentId != -1){
|
||||||
|
content = SErrorCodeEerverConfig.getMsgById(contentId);
|
||||||
|
}
|
||||||
//发货
|
//发货
|
||||||
if(!rewardStr.isEmpty()){
|
if(!rewardStr.isEmpty()){
|
||||||
int nowTime =(int) (TimeUtils.now()/1000);
|
int nowTime =(int) (TimeUtils.now()/1000);
|
||||||
|
|
@ -425,38 +451,71 @@ public class BuyGoodsNewLogic {
|
||||||
/**
|
/**
|
||||||
* 刷新单个礼包状态
|
* 刷新单个礼包状态
|
||||||
*/
|
*/
|
||||||
public static boolean refreshUnitWF(AbstractWelfareBag bag,List<Integer> garbageList,User user){
|
public static boolean refreshUnitWF(AbstractWelfareBag bag,User user){
|
||||||
if(bag.isProhibited() && !garbageList.contains(bag.getModId())){
|
if(bag.getModId() == 78 || bag.getModId() == 79){
|
||||||
garbageList.add(bag.getModId());
|
System.out.println();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
//判断刷新时间
|
//判断刷新时间
|
||||||
if(bag.getRefreshTime() > System.currentTimeMillis()){
|
if(bag.getRefreshTime() != 0 && bag.getRefreshTime() < System.currentTimeMillis()){
|
||||||
bag.setOpen(true);
|
bag.setOpen(true);
|
||||||
bag.setStartTime(bag.getRefreshTime());
|
bag.setStartTime(TimeUtils.getTodayZero());
|
||||||
bag.refresh();
|
bag.refresh();
|
||||||
}
|
}
|
||||||
if(bag.isOpen()){
|
if(bag.isOpen()){
|
||||||
if(bag.getType() != 1 && System.currentTimeMillis() > bag.getEndTime()){
|
if(bag.getType() != 1 && bag.getEndTime() != 0 && System.currentTimeMillis() > bag.getEndTime()){
|
||||||
bagTimeUp(user,bag);
|
bagTimeUp(user,bag);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
boolean open = true;
|
if(bag.getType() == RechargeType.timeLimit.getType()){//活动类型特殊处理
|
||||||
if(System.currentTimeMillis() > bag.getStartTime()){
|
for(String[] I : bag.getCondition()){
|
||||||
if(bag.getType() != RechargeType.perpetual.getType()){
|
if(I[0].equals("3")){
|
||||||
for(String[] con : bag.getCondition()){
|
if(ActivityLogic.checkActivityOpen(user,Integer.parseInt(I[1]))){
|
||||||
if(!judgeOpen(con,user)){
|
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(Integer.parseInt(I[1]));
|
||||||
open = false;
|
bag.setStartTime(sGlobalActivity.getStartTimeLong());
|
||||||
break;
|
bag.setEndTime(sGlobalActivity.getEndTimeLong());
|
||||||
|
bag.setOpen(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else{
|
||||||
open = false;
|
if(bag.getTimeType() == 9){
|
||||||
}
|
boolean init = true;
|
||||||
if(open){
|
for(String[] con : bag.getCondition()){
|
||||||
bag.setOpen(true);
|
if(!judgeOpen(con,user)){
|
||||||
return true;
|
init = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(init){
|
||||||
|
long endTime = 0;
|
||||||
|
for(String[] con : bag.getCondition()){
|
||||||
|
if(con[0].equals("4")){
|
||||||
|
endTime = Long.parseLong(con[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bag.setStartTime(TimeUtils.getTodayZero());
|
||||||
|
bag.setEndTime(TimeUtils.getTodayZero() + endTime);
|
||||||
|
bag.setOpen(true);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
boolean open = true;
|
||||||
|
if(System.currentTimeMillis() > bag.getStartTime()){
|
||||||
|
if(bag.getType() > RechargeType.timeLimit.getType()){
|
||||||
|
for(String[] con : bag.getCondition()){
|
||||||
|
if(!judgeOpen(con,user)){
|
||||||
|
open = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
open = false;
|
||||||
|
}
|
||||||
|
if(open){
|
||||||
|
bag.setOpen(true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -488,10 +547,6 @@ public class BuyGoodsNewLogic {
|
||||||
*/
|
*/
|
||||||
public static void bagTimeUp(User user,AbstractWelfareBag bag){
|
public static void bagTimeUp(User user,AbstractWelfareBag bag){
|
||||||
bag.setOpen((false));
|
bag.setOpen((false));
|
||||||
if(bag.getType() == RechargeType.timeLimit.getType() && bag.getDailyUpdate()<1){
|
|
||||||
bag.setProhibited(true);
|
|
||||||
user.getPlayerInfoManager().getNewRechargeInfo().removeTimeLimit((TimeLimitWelfareBag)bag);
|
|
||||||
}
|
|
||||||
if(bag.getType() == RechargeType.push.getType()){
|
if(bag.getType() == RechargeType.push.getType()){
|
||||||
user.getPlayerInfoManager().getNewRechargeInfo().removePush((PushWelfareBag) bag);
|
user.getPlayerInfoManager().getNewRechargeInfo().removePush((PushWelfareBag) bag);
|
||||||
}
|
}
|
||||||
|
|
@ -501,17 +556,19 @@ public class BuyGoodsNewLogic {
|
||||||
* 礼包开启条件判断(除了时间)
|
* 礼包开启条件判断(除了时间)
|
||||||
*/
|
*/
|
||||||
public static boolean judgeOpen(String[] con,User user) {
|
public static boolean judgeOpen(String[] con,User user) {
|
||||||
if(con[0].equals("1")){
|
if(con[0].equals("1")){//玩家等级
|
||||||
int level = user.getPlayerInfoManager().getLevel();
|
int level = user.getPlayerInfoManager().getLevel();
|
||||||
if(Integer.parseInt(con[1]) <= level && level <= Integer.parseInt(con[2])){
|
if(Integer.parseInt(con[1]) <= level && level <= Integer.parseInt(con[2])){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}else if(con[0].equals("2")){
|
}else if(con[0].equals("2")){//功能开启
|
||||||
return GlobalDataManaager.getInstance().checkIsOpen(Integer.parseInt(con[1]));
|
return GlobalDataManaager.getInstance().checkIsOpen(Integer.parseInt(con[1]));
|
||||||
}else if(con[0].equals("3")){
|
}else if(con[0].equals("3")){//活动开启
|
||||||
|
return ActivityLogic.checkActivityOpen(user,Integer.parseInt(con[1]));
|
||||||
}else if(con[0].equals("5")){
|
}else if(con[0].equals("4")){//时间类全部true
|
||||||
|
return true;
|
||||||
|
}else if(con[0].equals("5")){//激活高级月卡
|
||||||
|
return user.getPlayerInfoManager().getMonthCard().get(Global.LMONTHCARDID)==null?false:true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -558,7 +615,12 @@ public class BuyGoodsNewLogic {
|
||||||
builder.setBuyTimes(bag.getBuyTimes());
|
builder.setBuyTimes(bag.getBuyTimes());
|
||||||
builder.setStartTime((int)(bag.getStartTime()/1000));
|
builder.setStartTime((int)(bag.getStartTime()/1000));
|
||||||
builder.setEndTime((int)(bag.getEndTime()/1000));
|
builder.setEndTime((int)(bag.getEndTime()/1000));
|
||||||
builder.setDynamicBuyTimes(bag.getLimit() - bag.getBuyTimes());
|
if(bag.getLimit() == 0){
|
||||||
|
builder.setDynamicBuyTimes(1);
|
||||||
|
}else{
|
||||||
|
builder.setDynamicBuyTimes(bag.getLimit() - bag.getBuyTimes());
|
||||||
|
}
|
||||||
|
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -629,4 +691,18 @@ public class BuyGoodsNewLogic {
|
||||||
}
|
}
|
||||||
return con.getPacks()[index];
|
return con.getPacks()[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取礼包结束时间
|
||||||
|
*/
|
||||||
|
public static List<CommonProto.GoodsTypeDuration> getGoodsTypeDurations(User user){
|
||||||
|
List<CommonProto.GoodsTypeDuration> list = new ArrayList<>();
|
||||||
|
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||||
|
for(AbstractWelfareBag bag : info.getTimeLimitBagList()){
|
||||||
|
CommonProto.GoodsTypeDuration goodsTypeDuration = CommonProto.GoodsTypeDuration.newBuilder()
|
||||||
|
.setGoodsType(bag.getModId()).setEndTime((int)(bag.getEndTime()/1000)).build();
|
||||||
|
list.add(goodsTypeDuration);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,14 @@
|
||||||
package com.ljsd.jieling.logic.store.newRechargeInfo;
|
package com.ljsd.jieling.logic.store.newRechargeInfo;
|
||||||
|
|
||||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.PerpetualWelfareBag;
|
import com.ljsd.common.mogodb.MongoBase;
|
||||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.PushWelfareBag;
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.*;
|
||||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
|
|
||||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.TimeLimitWelfareBag;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class NewRechargeInfo {
|
public class NewRechargeInfo extends MongoBase {
|
||||||
|
|
||||||
private double rr;//累计充值
|
private double rr;//累计充值
|
||||||
|
|
||||||
|
|
@ -25,7 +23,6 @@ public class NewRechargeInfo {
|
||||||
private Map<Integer,TimeLimitWelfareBag> timeLimitMap = new HashMap<>();//限时刷新礼包
|
private Map<Integer,TimeLimitWelfareBag> timeLimitMap = new HashMap<>();//限时刷新礼包
|
||||||
private Map<Integer,ReceiveWelfareBag> receiveMap = new HashMap<>();//限时刷新礼包
|
private Map<Integer,ReceiveWelfareBag> receiveMap = new HashMap<>();//限时刷新礼包
|
||||||
private Map<Integer,PushWelfareBag> pushMap = new HashMap<>();//推送礼包
|
private Map<Integer,PushWelfareBag> pushMap = new HashMap<>();//推送礼包
|
||||||
private List<Integer> garbage = new ArrayList<>();//废弃礼包
|
|
||||||
|
|
||||||
private long lostTime; //上次记录时间
|
private long lostTime; //上次记录时间
|
||||||
private int mainLineLost; //记录主线失败次数
|
private int mainLineLost; //记录主线失败次数
|
||||||
|
|
@ -49,12 +46,34 @@ public class NewRechargeInfo {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<AbstractWelfareBag> getTimeLimitBagList(){
|
||||||
|
List<AbstractWelfareBag> list = new ArrayList<>();
|
||||||
|
for(AbstractWelfareBag bag : timeLimitMap.values()){
|
||||||
|
if(bag.getEndTime() > 0){
|
||||||
|
list.add(bag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(AbstractWelfareBag bag : receiveMap.values()){
|
||||||
|
if(bag.getEndTime() > 0){
|
||||||
|
list.add(bag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(AbstractWelfareBag bag : pushMap.values()){
|
||||||
|
if(bag.getEndTime() > 0){
|
||||||
|
list.add(bag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
public double getRr() {
|
public double getRr() {
|
||||||
return rr;
|
return rr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRr(double rr) {
|
public void setRr(double rr) {
|
||||||
this.rr = rr;
|
this.rr = rr;
|
||||||
|
updateString("rr",rr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getMonthRr() {
|
public double getMonthRr() {
|
||||||
|
|
@ -63,6 +82,8 @@ public class NewRechargeInfo {
|
||||||
|
|
||||||
public void setMonthRr(double monthRr) {
|
public void setMonthRr(double monthRr) {
|
||||||
this.monthRr = monthRr;
|
this.monthRr = monthRr;
|
||||||
|
updateString("monthRr",monthRr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getsMonthRr() {
|
public double getsMonthRr() {
|
||||||
|
|
@ -71,6 +92,7 @@ public class NewRechargeInfo {
|
||||||
|
|
||||||
public void setsMonthRr(double sMonthRr) {
|
public void setsMonthRr(double sMonthRr) {
|
||||||
this.sMonthRr = sMonthRr;
|
this.sMonthRr = sMonthRr;
|
||||||
|
updateString("sMonthRr",sMonthRr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getIsFirst() {
|
public boolean getIsFirst() {
|
||||||
|
|
@ -79,6 +101,7 @@ public class NewRechargeInfo {
|
||||||
|
|
||||||
public void setIsFirst(boolean isFirst) {
|
public void setIsFirst(boolean isFirst) {
|
||||||
this.isFirst = isFirst;
|
this.isFirst = isFirst;
|
||||||
|
updateString("isFirst",isFirst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getFirstTime() {
|
public long getFirstTime() {
|
||||||
|
|
@ -87,6 +110,7 @@ public class NewRechargeInfo {
|
||||||
|
|
||||||
public void setFirstTime(long firstTime) {
|
public void setFirstTime(long firstTime) {
|
||||||
this.firstTime = firstTime;
|
this.firstTime = firstTime;
|
||||||
|
updateString("firstTime",firstTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIsDayFirst() {
|
public int getIsDayFirst() {
|
||||||
|
|
@ -95,74 +119,57 @@ public class NewRechargeInfo {
|
||||||
|
|
||||||
public void setIsDayFirst(int isDayFirst) {
|
public void setIsDayFirst(int isDayFirst) {
|
||||||
this.isDayFirst = isDayFirst;
|
this.isDayFirst = isDayFirst;
|
||||||
|
updateString("isDayFirst",isDayFirst);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, PerpetualWelfareBag> getPerpetualMap() {
|
public Map<Integer, PerpetualWelfareBag> getPerpetualMap() {
|
||||||
return perpetualMap;
|
return perpetualMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPerpetualMap(Map<Integer, PerpetualWelfareBag> perpetualMap) {
|
|
||||||
this.perpetualMap = perpetualMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<Integer, TimeLimitWelfareBag> getTimeLimitMap() {
|
public Map<Integer, TimeLimitWelfareBag> getTimeLimitMap() {
|
||||||
return timeLimitMap;
|
return timeLimitMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimeLimitMap(Map<Integer, TimeLimitWelfareBag> timeLimitMap) {
|
|
||||||
this.timeLimitMap = timeLimitMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<Integer, ReceiveWelfareBag> getReceiveMap() {
|
public Map<Integer, ReceiveWelfareBag> getReceiveMap() {
|
||||||
return receiveMap;
|
return receiveMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReceiveMap(Map<Integer, ReceiveWelfareBag> receiveMap) {
|
|
||||||
this.receiveMap = receiveMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<Integer, PushWelfareBag> getPushMap() {
|
public Map<Integer, PushWelfareBag> getPushMap() {
|
||||||
return pushMap;
|
return pushMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPushMap(Map<Integer, PushWelfareBag> pushMap) {
|
|
||||||
this.pushMap = pushMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Integer> getGarbage() {
|
|
||||||
return garbage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGarbage(List<Integer> garbage) {
|
|
||||||
this.garbage = garbage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addPerpetual(PerpetualWelfareBag bag){
|
public void addPerpetual(PerpetualWelfareBag bag){
|
||||||
perpetualMap.put(bag.getModId(),bag);
|
perpetualMap.put(bag.getModId(),bag);
|
||||||
|
bag.init(this.getRootId(),getMongoKey() + ".perpetualMap." + bag.getModId());
|
||||||
|
updateString("perpetualMap",perpetualMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTimeLimit(TimeLimitWelfareBag bag){
|
public void addTimeLimit(TimeLimitWelfareBag bag){
|
||||||
timeLimitMap.put(bag.getModId(),bag);
|
timeLimitMap.put(bag.getModId(),bag);
|
||||||
}
|
bag.init(this.getRootId(),getMongoKey() + ".timeLimitMap." + bag.getModId());
|
||||||
|
updateString("timeLimitMap",timeLimitMap);
|
||||||
public void removeTimeLimit(TimeLimitWelfareBag bag){
|
|
||||||
timeLimitMap.remove(bag.getModId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addReceive(ReceiveWelfareBag bag){
|
public void addReceive(ReceiveWelfareBag bag){
|
||||||
receiveMap.put(bag.getModId(),bag);
|
receiveMap.put(bag.getModId(),bag);
|
||||||
|
bag.init(this.getRootId(),getMongoKey() + ".receiveMap." + bag.getModId());
|
||||||
|
updateString("receiveMap",receiveMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPush(PushWelfareBag bag){
|
public void addPush(PushWelfareBag bag){
|
||||||
pushMap.put(bag.getModId(),bag);
|
pushMap.put(bag.getModId(),bag);
|
||||||
|
bag.init(this.getRootId(),getMongoKey() + ".pushMap." + bag.getModId());
|
||||||
|
updateString("pushMap",pushMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePush(PushWelfareBag bag){
|
public void removePush(PushWelfareBag bag){
|
||||||
pushMap.remove(bag.getModId());
|
pushMap.remove(bag.getModId());
|
||||||
}
|
updateString("pushMap",pushMap);
|
||||||
|
|
||||||
public void addGarbage(List<Integer> list){
|
|
||||||
garbage.addAll(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMainLineLost() {
|
public int getMainLineLost() {
|
||||||
|
|
@ -171,10 +178,12 @@ public class NewRechargeInfo {
|
||||||
|
|
||||||
public void setMainLineLost(int mainLineLost) {
|
public void setMainLineLost(int mainLineLost) {
|
||||||
this.mainLineLost = mainLineLost;
|
this.mainLineLost = mainLineLost;
|
||||||
|
updateString("mainLineLost",mainLineLost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMainLineLost() {
|
public void addMainLineLost() {
|
||||||
mainLineLost++;
|
mainLineLost++;
|
||||||
|
updateString("mainLineLost",mainLineLost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTowerLost() {
|
public int getTowerLost() {
|
||||||
|
|
@ -183,9 +192,11 @@ public class NewRechargeInfo {
|
||||||
|
|
||||||
public void setTowerLost(int towerLost) {
|
public void setTowerLost(int towerLost) {
|
||||||
this.towerLost = towerLost;
|
this.towerLost = towerLost;
|
||||||
|
updateString("towerLost",towerLost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTowerLost() {
|
public void addTowerLost() {
|
||||||
towerLost++;
|
towerLost++;
|
||||||
|
updateString("towerLost",towerLost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,43 @@
|
||||||
package com.ljsd.jieling.logic.store.newRechargeInfo;
|
package com.ljsd.jieling.logic.store.newRechargeInfo;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public enum RechargeType {
|
public enum RechargeType {
|
||||||
perpetual(1),
|
perpetual(1,new PerpetualHandler()),
|
||||||
timeLimit(2),
|
timeLimit(2,new TimeLimitHandler()),
|
||||||
receive(3),
|
receive(3,new ReceiveHandler()),
|
||||||
push(4),
|
push(4,new PushHandler()),
|
||||||
;
|
;
|
||||||
|
|
||||||
private int type;
|
private int type;
|
||||||
|
|
||||||
RechargeType(int type){
|
private RechargeHandler rechargeHandler;
|
||||||
|
|
||||||
|
RechargeType(int type, RechargeHandler rechargeHandler){
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
this.rechargeHandler = rechargeHandler;
|
||||||
|
}
|
||||||
|
private static Map<Integer,RechargeType> rankMap;
|
||||||
|
|
||||||
|
static {
|
||||||
|
rankMap = new HashMap<>();
|
||||||
|
RechargeType[] values = RechargeType.values();
|
||||||
|
Arrays.stream(values).forEach(n->rankMap.put(n.getType(),n));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RechargeHandler getRechargeHandler() {
|
||||||
|
return rechargeHandler;
|
||||||
|
}
|
||||||
|
public static RechargeHandler getHandler(int type){
|
||||||
|
return rankMap.get(type).getRechargeHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
package com.ljsd.jieling.logic.store.newRechargeInfo.bean;
|
|
||||||
|
|
||||||
public interface WelfareBag {
|
|
||||||
public boolean buy();
|
|
||||||
public String sendGoods() throws Exception;
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
||||||
|
import config.SRechargeCommodityNewConfig;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lvxinran
|
||||||
|
* @date 2021/4/20
|
||||||
|
* @discribe
|
||||||
|
*/
|
||||||
|
public abstract class AbstractRechargeHandler implements RechargeHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean refreshStatus(User user,int rechargeId){
|
||||||
|
Map<Integer, ? extends AbstractWelfareBag> rechargeMap = getRechargeMap(user);
|
||||||
|
|
||||||
|
return BuyGoodsNewLogic.refreshUnitWF(rechargeMap.get(rechargeId), user.getPlayerInfoManager().getNewRechargeInfo().getGarbage(), user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract Map<Integer, ? extends AbstractWelfareBag> getRechargeMap(User user);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean rechargeIsInBag(User user, int rechargeId) {
|
||||||
|
return getRechargeMap(user).containsKey(rechargeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract AbstractWelfareBag initUnitWF(User user, SRechargeCommodityNewConfig config) throws Exception;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.PerpetualWelfareBag;
|
||||||
|
import config.SRechargeCommodityNewConfig;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lvxinran
|
||||||
|
* @date 2021/4/20
|
||||||
|
* @discribe
|
||||||
|
*/
|
||||||
|
public class PerpetualHandler extends AbstractRechargeHandler{
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Integer, ? extends AbstractWelfareBag> getRechargeMap(User user) {
|
||||||
|
return user.getPlayerInfoManager().getNewRechargeInfo().getPerpetualMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbstractWelfareBag initUnitWF(User user, SRechargeCommodityNewConfig config) throws Exception {
|
||||||
|
return new PerpetualWelfareBag(user,config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addNew(User user, AbstractWelfareBag bag) {
|
||||||
|
user.getPlayerInfoManager().getNewRechargeInfo().addPerpetual((PerpetualWelfareBag) bag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.PushWelfareBag;
|
||||||
|
import config.SRechargeCommodityNewConfig;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lvxinran
|
||||||
|
* @date 2021/4/20
|
||||||
|
* @discribe
|
||||||
|
*/
|
||||||
|
public class PushHandler extends AbstractRechargeHandler {
|
||||||
|
@Override
|
||||||
|
public Map<Integer, ? extends AbstractWelfareBag> getRechargeMap(User user) {
|
||||||
|
return user.getPlayerInfoManager().getNewRechargeInfo().getPushMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbstractWelfareBag initUnitWF(User user, SRechargeCommodityNewConfig config) {
|
||||||
|
return new PushWelfareBag(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addNew(User user, AbstractWelfareBag bag) {
|
||||||
|
user.getPlayerInfoManager().getNewRechargeInfo().addPush((PushWelfareBag) bag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
|
||||||
|
import config.SRechargeCommodityNewConfig;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lvxinran
|
||||||
|
* @date 2021/4/20
|
||||||
|
* @discribe
|
||||||
|
*/
|
||||||
|
public class ReceiveHandler extends AbstractRechargeHandler {
|
||||||
|
@Override
|
||||||
|
public Map<Integer, ? extends AbstractWelfareBag> getRechargeMap(User user) {
|
||||||
|
return user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbstractWelfareBag initUnitWF(User user, SRechargeCommodityNewConfig config)throws Exception {
|
||||||
|
return new ReceiveWelfareBag(user,config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addNew(User user, AbstractWelfareBag bag) {
|
||||||
|
user.getPlayerInfoManager().getNewRechargeInfo().addReceive((ReceiveWelfareBag) bag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
||||||
|
import config.SRechargeCommodityNewConfig;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface RechargeHandler {
|
||||||
|
|
||||||
|
boolean refreshStatus(User user,int rechargeId);
|
||||||
|
|
||||||
|
Map<Integer,? extends AbstractWelfareBag> getRechargeMap(User user);
|
||||||
|
|
||||||
|
boolean rechargeIsInBag(User user,int rechargeId);
|
||||||
|
|
||||||
|
void addNew(User user,AbstractWelfareBag bag);
|
||||||
|
|
||||||
|
AbstractWelfareBag initUnitWF(User user, SRechargeCommodityNewConfig config) throws Exception;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler;
|
||||||
|
|
||||||
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
||||||
|
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.TimeLimitWelfareBag;
|
||||||
|
import config.SRechargeCommodityNewConfig;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author lvxinran
|
||||||
|
* @date 2021/4/20
|
||||||
|
* @discribe
|
||||||
|
*/
|
||||||
|
public class TimeLimitHandler extends AbstractRechargeHandler{
|
||||||
|
@Override
|
||||||
|
public Map<Integer, ? extends AbstractWelfareBag> getRechargeMap(User user) {
|
||||||
|
return user.getPlayerInfoManager().getNewRechargeInfo().getTimeLimitMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbstractWelfareBag initUnitWF(User user, SRechargeCommodityNewConfig config) throws Exception {
|
||||||
|
return new TimeLimitWelfareBag(user,config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addNew(User user, AbstractWelfareBag bag) {
|
||||||
|
user.getPlayerInfoManager().getNewRechargeInfo().addTimeLimit((TimeLimitWelfareBag) bag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@ import manager.Table;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Table(name ="RechargeCommodityNewConfig")
|
@Table(name ="RechargeCommodityConfig")
|
||||||
public class SRechargeCommodityNewConfig implements BaseConfig {
|
public class SRechargeCommodityNewConfig implements BaseConfig {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue