新礼包
parent
54a3149de6
commit
972806ba8f
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.db.mongo;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoSettingsProperties;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.PushWelfareBag;
|
||||
import com.mongodb.MongoClient;
|
||||
import com.mongodb.MongoClientOptions;
|
||||
import com.mongodb.MongoClientURI;
|
||||
|
|
@ -83,6 +84,10 @@ public class MongoConfig {
|
|||
private CustomConversions customConversions() {
|
||||
List<Converter<?, ?>> converterList = new ArrayList<Converter<?, ?>>();
|
||||
converterList.add(new MongoPropertyConverter());
|
||||
converterList.add(new MongoPerpetualConverter());
|
||||
converterList.add(new MongoTimeLimitConverter());
|
||||
converterList.add(new MongoReceiveConverter());
|
||||
converterList.add(new MongoPushConverter());
|
||||
return new CustomConversions(converterList);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ 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();
|
||||
public class MongoPerpetualConverter implements Converter<BasicDBObject, PerpetualWelfareBag> {
|
||||
Gson gson = new Gson();
|
||||
@Override
|
||||
public PerpetualWelfareBag convert(BasicDBObject source) {
|
||||
|
|
@ -24,7 +23,6 @@ public class MongoWelfareBagConverter implements Converter<BasicDBObject, Perpet
|
|||
target = PerpetualWelfareBag.class;
|
||||
}
|
||||
String s = gson.toJson(source);
|
||||
// String realJson = source.toJson(jsonWriterSettinsgs);
|
||||
PerpetualWelfareBag bag = JSON.parseObject(s,target);
|
||||
return bag;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.ljsd.jieling.db.mongo;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.RechargeType;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.PushWelfareBag;
|
||||
import com.mongodb.BasicDBObject;
|
||||
import config.SRechargeCommodityNewConfig;
|
||||
import manager.STableManager;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
public class MongoPushConverter implements Converter<BasicDBObject, PushWelfareBag> {
|
||||
Gson gson = new Gson();
|
||||
@Override
|
||||
public PushWelfareBag convert(BasicDBObject source) {
|
||||
SRechargeCommodityNewConfig config = STableManager.getConfig(SRechargeCommodityNewConfig.class).get(source.getInt("modId"));
|
||||
Class<? extends PushWelfareBag> target = PushWelfareBag.class;
|
||||
if(config.getOtype() == RechargeType.perpetual.getType()){
|
||||
target = PushWelfareBag.class;
|
||||
}
|
||||
String s = gson.toJson(source);
|
||||
PushWelfareBag bag = JSON.parseObject(s,target);
|
||||
return bag;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.ljsd.jieling.db.mongo;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.RechargeType;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
|
||||
import com.mongodb.BasicDBObject;
|
||||
import config.SRechargeCommodityNewConfig;
|
||||
import manager.STableManager;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
public class MongoReceiveConverter implements Converter<BasicDBObject, ReceiveWelfareBag> {
|
||||
Gson gson = new Gson();
|
||||
@Override
|
||||
public ReceiveWelfareBag convert(BasicDBObject source) {
|
||||
SRechargeCommodityNewConfig config = STableManager.getConfig(SRechargeCommodityNewConfig.class).get(source.getInt("modId"));
|
||||
Class<? extends ReceiveWelfareBag> target = ReceiveWelfareBag.class;
|
||||
if(config.getOtype() == RechargeType.perpetual.getType()){
|
||||
target = ReceiveWelfareBag.class;
|
||||
}
|
||||
String s = gson.toJson(source);
|
||||
ReceiveWelfareBag bag = JSON.parseObject(s,target);
|
||||
return bag;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.ljsd.jieling.db.mongo;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.RechargeType;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.PerpetualWelfareBag;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.TimeLimitWelfareBag;
|
||||
import com.mongodb.BasicDBObject;
|
||||
import config.SRechargeCommodityNewConfig;
|
||||
import manager.STableManager;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
public class MongoTimeLimitConverter implements Converter<BasicDBObject, TimeLimitWelfareBag> {
|
||||
Gson gson = new Gson();
|
||||
@Override
|
||||
public TimeLimitWelfareBag convert(BasicDBObject source) {
|
||||
SRechargeCommodityNewConfig config = STableManager.getConfig(SRechargeCommodityNewConfig.class).get(source.getInt("modId"));
|
||||
Class<? extends TimeLimitWelfareBag> target = TimeLimitWelfareBag.class;
|
||||
if(config.getOtype() == RechargeType.timeLimit.getType()){
|
||||
target = TimeLimitWelfareBag.class;
|
||||
}
|
||||
String s = gson.toJson(source);
|
||||
TimeLimitWelfareBag bag = JSON.parseObject(s,target);
|
||||
return bag;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -127,15 +127,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
}
|
||||
}
|
||||
|
||||
// Map<Integer, Integer> goodsTypeDurationMap = rechargeInfo.getGoodsDurationMap();
|
||||
// List<CommonProto.GoodsTypeDuration> goodsTypeDurations = new ArrayList<>(3);
|
||||
// for(Map.Entry<Integer,Integer> entry : goodsTypeDurationMap.entrySet()){
|
||||
// Integer goodsId = entry.getKey();
|
||||
// Integer goodsEndTime = entry.getValue();
|
||||
//// SRechargeCommodityConfig sRechargeCommodityConfig = SRechargeCommodityConfig.rechargeCommodityConfigMap.get(goodsId);
|
||||
//
|
||||
// goodsTypeDurations.add(CommonProto.GoodsTypeDuration.newBuilder().setGoodsType(goodsId).setEndTime(goodsEndTime).build());
|
||||
// }
|
||||
List<CommonProto.GoodsTypeDuration> goodsTypeDurations = BuyGoodsNewLogic.getGoodsTypeDurations(user);
|
||||
//问卷状态
|
||||
int questState =-1;
|
||||
GlobalSystemControl globalSystemControl = GlobalSystemControl.getGlobalSystemControl();
|
||||
|
|
@ -204,7 +196,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.addAllRedType(playerInfoManager.getReds())
|
||||
.setRandCount(alreadyCount)
|
||||
.addAllHeroHandBook(heroHandBookList).addAllEquipHandBook(equipHandBookSet)
|
||||
// .addAllGoodsTypeDuration(goodsTypeDurations)
|
||||
.addAllGoodsTypeDuration(goodsTypeDurations)
|
||||
.setHadBuyTreasure(playerInfoManager.getHadBuyTreasure())
|
||||
.setTreasureLevel(playerInfoManager.getTreasureLevel())
|
||||
.setSignInInfo(CommonProto.SignInInfo.newBuilder().setDays(playerInfoManager.getSign()+1).setState(playerInfoManager.getSignTotay()).build())
|
||||
|
|
|
|||
|
|
@ -379,7 +379,11 @@ public class GlobalDataManaager implements IManager {
|
|||
}
|
||||
|
||||
public static void flushGoodsTimes(User user){
|
||||
BuyGoodsNewLogic.refreshWelfareState(user);
|
||||
try{
|
||||
BuyGoodsNewLogic.refreshWelfareState(user);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void everTask(int hour){
|
||||
|
|
|
|||
|
|
@ -1384,13 +1384,11 @@ public class ActivityLogic implements IEventHandler{
|
|||
|
||||
|
||||
//检查活动是否开启
|
||||
public boolean checkActivityOpen(User user, int activityType) {
|
||||
public static boolean checkActivityOpen(User user, int activityType) {
|
||||
ActivityManager activityManager = user.getActivityManager();
|
||||
Map<Integer, ActivityMission> activityMissionMap = activityManager.getActivityMissionMap();
|
||||
for (Map.Entry<Integer, ActivityMission> item : activityMissionMap.entrySet()) {
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(item.getKey());
|
||||
int targetActivityType = sGlobalActivity.getType();
|
||||
if (targetActivityType == activityType) {
|
||||
if (item.getKey() == activityType) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1033,6 +1033,8 @@ public class PlayerManager extends MongoBase {
|
|||
}
|
||||
|
||||
public void setNewRechargeInfo(NewRechargeInfo newRechargeInfo) {
|
||||
newRechargeInfo.init(this.getRootId(), getMongoKey()+".newRechargeInfo");
|
||||
this.newRechargeInfo = newRechargeInfo;
|
||||
updateString("newRechargeInfo", newRechargeInfo);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,36 +75,8 @@ public class BuyGoodsNewLogic {
|
|||
user.getPlayerInfoManager().setNewRechargeInfo(info);
|
||||
}
|
||||
for(Map.Entry<Integer,SRechargeCommodityNewConfig> entry : SRechargeCommodityNewConfig.configMap.entrySet()){
|
||||
//<<<<<<< HEAD
|
||||
// if(entry.getValue().getOnSaleRule().equals("") || entry.getValue().getOtype() == 0){
|
||||
// continue;
|
||||
// }
|
||||
// Map<Integer, PerpetualWelfareBag> perpetualWelfareBagMap = info.getPerpetualMap();
|
||||
// Map<Integer, TimeLimitWelfareBag> timeLimitWelfareBagMap = info.getTimeLimitMap();
|
||||
// Map<Integer, ReceiveWelfareBag> receiveWelfareBagMap = info.getReceiveMap();
|
||||
// Map<Integer, PushWelfareBag> pushWelfareBagMap = info.getPushMap();
|
||||
// if(perpetualWelfareBagMap.containsKey(entry.getKey())){
|
||||
// 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());
|
||||
|
|
@ -221,8 +193,6 @@ public class BuyGoodsNewLogic {
|
|||
info.setRr(MathUtils.doubleAdd(price,info.getRr()));
|
||||
//处理月卡
|
||||
user.getPlayerInfoManager().getMonthCard();
|
||||
info.setMonthRr(MathUtils.doubleAdd(price,info.getMonthRr()));
|
||||
info.setsMonthRr(MathUtils.doubleAdd(price,info.getsMonthRr()));
|
||||
activeMonthCard(user,price,info);
|
||||
//活动
|
||||
changeActivity(user,price,info);
|
||||
|
|
@ -403,14 +373,20 @@ public class BuyGoodsNewLogic {
|
|||
int monthline = STableManager.getConfig(SMonthcardConfig.class).get(Global.MONTHCARDID).getPrice();
|
||||
int lmonthline = STableManager.getConfig(SMonthcardConfig.class).get(Global.LMONTHCARDID).getPrice();
|
||||
boolean sendneed =false;
|
||||
if(info.getMonthRr()<monthline&&(MathUtils.doubleAdd(price,info.getMonthRr()))>=monthline){
|
||||
sendneed=true;
|
||||
user.getPlayerInfoManager().getMonthCard().put(Global.MONTHCARDID, (int) (System.currentTimeMillis() / 1000));
|
||||
if(info.getMonthRr()<monthline){
|
||||
info.setMonthRr(MathUtils.doubleAdd(price,info.getMonthRr()));
|
||||
if(info.getMonthRr()>=monthline){
|
||||
sendneed=true;
|
||||
user.getPlayerInfoManager().getMonthCard().put(Global.MONTHCARDID, (int) (System.currentTimeMillis() / 1000));
|
||||
}
|
||||
}
|
||||
if(info.getsMonthRr()<lmonthline&&(MathUtils.doubleAdd(price,info.getsMonthRr()))>=lmonthline){
|
||||
sendneed=true;
|
||||
user.getPlayerInfoManager().getMonthCard().put(Global.LMONTHCARDID, (int) (System.currentTimeMillis() / 1000));
|
||||
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.RECHARGE_BUY.getType(),Global.LMONTHCARDID));
|
||||
if(info.getsMonthRr()<lmonthline){
|
||||
info.setsMonthRr(MathUtils.doubleAdd(price,info.getsMonthRr()));
|
||||
if(info.getsMonthRr()>=lmonthline){
|
||||
sendneed=true;
|
||||
user.getPlayerInfoManager().getMonthCard().put(Global.LMONTHCARDID, (int) (System.currentTimeMillis() / 1000));
|
||||
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.RECHARGE_BUY.getType(),Global.LMONTHCARDID));
|
||||
}
|
||||
}
|
||||
if(sendneed){
|
||||
ISession session = OnlineUserManager.sessionMap.get(user.getId());
|
||||
|
|
@ -452,9 +428,6 @@ public class BuyGoodsNewLogic {
|
|||
* 刷新单个礼包状态
|
||||
*/
|
||||
public static boolean refreshUnitWF(AbstractWelfareBag bag,User user){
|
||||
if(bag.getModId() == 78 || bag.getModId() == 79){
|
||||
System.out.println();
|
||||
}
|
||||
//判断刷新时间
|
||||
if(bag.getRefreshTime() != 0 && bag.getRefreshTime() < System.currentTimeMillis()){
|
||||
bag.setOpen(true);
|
||||
|
|
@ -490,11 +463,11 @@ public class BuyGoodsNewLogic {
|
|||
long endTime = 0;
|
||||
for(String[] con : bag.getCondition()){
|
||||
if(con[0].equals("4")){
|
||||
endTime = Long.parseLong(con[1]);
|
||||
endTime = Long.parseLong(con[2])*1000;
|
||||
}
|
||||
}
|
||||
bag.setStartTime(TimeUtils.getTodayZero());
|
||||
bag.setEndTime(TimeUtils.getTodayZero() + endTime);
|
||||
bag.setStartTime(System.currentTimeMillis());
|
||||
bag.setEndTime(bag.getStartTime() + endTime);
|
||||
bag.setOpen(true);
|
||||
}
|
||||
}else{
|
||||
|
|
@ -646,19 +619,24 @@ public class BuyGoodsNewLogic {
|
|||
}
|
||||
|
||||
public static void openPush(ISession session,User user,int type,int num) throws Exception{
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
List<SPackPushConfig> list = SPackPushConfig.findConfigByCon(type,num);
|
||||
if(list == null){
|
||||
return;
|
||||
}
|
||||
for(SPackPushConfig con : list){
|
||||
int bagId = judgePushCondition(user,con);
|
||||
if(bagId > 0){
|
||||
if(bagId > 0 && info.getNextPushTime() < System.currentTimeMillis()){
|
||||
info.setNextPushTime(System.currentTimeMillis() + con.getcDTime() * TimeUtils.HOUR);
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(bagId);
|
||||
initUnitWF(user,config);
|
||||
}
|
||||
}
|
||||
List<Integer> pushList = info.getPushList();
|
||||
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
|
||||
getGoodsBagInfo(user.getId(), goodsBagInfo);
|
||||
PlayerInfoProto.PushWelfareResponse pushWelfareResponse = PlayerInfoProto.PushWelfareResponse.newBuilder().addAllId(pushList).build();
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_WELFARE_RESPONSE.getNumber(), pushWelfareResponse, true);
|
||||
PlayerInfoProto.AllGiftGoodsIndication goodsBuild = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, goodsBuild, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public class NewRechargeInfo extends MongoBase {
|
|||
private long lostTime; //上次记录时间
|
||||
private int mainLineLost; //记录主线失败次数
|
||||
private int towerLost; //记录爬塔失败次数
|
||||
private long nextPushTime; //上次推送时间
|
||||
|
||||
|
||||
public boolean checkOneGoodsIsOverTimeByPrivilege(int privilegeId){
|
||||
|
|
@ -49,23 +50,31 @@ public class NewRechargeInfo extends MongoBase {
|
|||
public List<AbstractWelfareBag> getTimeLimitBagList(){
|
||||
List<AbstractWelfareBag> list = new ArrayList<>();
|
||||
for(AbstractWelfareBag bag : timeLimitMap.values()){
|
||||
if(bag.getEndTime() > 0){
|
||||
if(bag.isOpen() && bag.getEndTime() > 0){
|
||||
list.add(bag);
|
||||
}
|
||||
}
|
||||
for(AbstractWelfareBag bag : receiveMap.values()){
|
||||
if(bag.getEndTime() > 0){
|
||||
if(bag.isOpen() && bag.getEndTime() > 0){
|
||||
list.add(bag);
|
||||
}
|
||||
}
|
||||
for(AbstractWelfareBag bag : pushMap.values()){
|
||||
if(bag.getEndTime() > 0){
|
||||
if(bag.isOpen() && bag.getEndTime() > 0){
|
||||
list.add(bag);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Integer> getPushList(){
|
||||
List<Integer> list = new ArrayList<>();
|
||||
for(int i : pushMap.keySet()){
|
||||
list.add(i);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public double getRr() {
|
||||
return rr;
|
||||
}
|
||||
|
|
@ -146,30 +155,30 @@ public class NewRechargeInfo extends MongoBase {
|
|||
public void addPerpetual(PerpetualWelfareBag bag){
|
||||
perpetualMap.put(bag.getModId(),bag);
|
||||
bag.init(this.getRootId(),getMongoKey() + ".perpetualMap." + bag.getModId());
|
||||
updateString("perpetualMap",perpetualMap);
|
||||
updateString("perpetualMap."+bag.getModId(),bag);
|
||||
}
|
||||
|
||||
public void addTimeLimit(TimeLimitWelfareBag bag){
|
||||
timeLimitMap.put(bag.getModId(),bag);
|
||||
bag.init(this.getRootId(),getMongoKey() + ".timeLimitMap." + bag.getModId());
|
||||
updateString("timeLimitMap",timeLimitMap);
|
||||
updateString("timeLimitMap."+bag.getModId(),bag);
|
||||
}
|
||||
|
||||
public void addReceive(ReceiveWelfareBag bag){
|
||||
receiveMap.put(bag.getModId(),bag);
|
||||
bag.init(this.getRootId(),getMongoKey() + ".receiveMap." + bag.getModId());
|
||||
updateString("receiveMap",receiveMap);
|
||||
updateString("receiveMap."+bag.getModId(),bag);
|
||||
}
|
||||
|
||||
public void addPush(PushWelfareBag bag){
|
||||
pushMap.put(bag.getModId(),bag);
|
||||
bag.init(this.getRootId(),getMongoKey() + ".pushMap." + bag.getModId());
|
||||
updateString("pushMap",pushMap);
|
||||
updateString("pushMap."+bag.getModId(),bag);
|
||||
}
|
||||
|
||||
public void removePush(PushWelfareBag bag){
|
||||
pushMap.remove(bag.getModId());
|
||||
updateString("pushMap",pushMap);
|
||||
removeString(getMongoKey() + ".pushMap."+bag.getModId());
|
||||
}
|
||||
|
||||
public int getMainLineLost() {
|
||||
|
|
@ -199,4 +208,47 @@ public class NewRechargeInfo extends MongoBase {
|
|||
towerLost++;
|
||||
updateString("towerLost",towerLost);
|
||||
}
|
||||
|
||||
public boolean isFirst() {
|
||||
return isFirst;
|
||||
}
|
||||
|
||||
public void setFirst(boolean first) {
|
||||
isFirst = first;
|
||||
updateString("isFirst",isFirst);
|
||||
}
|
||||
|
||||
public void setPerpetualMap(Map<Integer, PerpetualWelfareBag> perpetualMap) {
|
||||
this.perpetualMap = perpetualMap;
|
||||
}
|
||||
|
||||
public void setTimeLimitMap(Map<Integer, TimeLimitWelfareBag> timeLimitMap) {
|
||||
this.timeLimitMap = timeLimitMap;
|
||||
}
|
||||
|
||||
public void setReceiveMap(Map<Integer, ReceiveWelfareBag> receiveMap) {
|
||||
this.receiveMap = receiveMap;
|
||||
}
|
||||
|
||||
public void setPushMap(Map<Integer, PushWelfareBag> pushMap) {
|
||||
this.pushMap = pushMap;
|
||||
}
|
||||
|
||||
public long getLostTime() {
|
||||
return lostTime;
|
||||
}
|
||||
|
||||
public void setLostTime(long lostTime) {
|
||||
this.lostTime = lostTime;
|
||||
updateString("lostTime",lostTime);
|
||||
}
|
||||
|
||||
public long getNextPushTime() {
|
||||
return nextPushTime;
|
||||
}
|
||||
|
||||
public void setNextPushTime(long nextPushTime) {
|
||||
this.nextPushTime = nextPushTime;
|
||||
updateString("nextPushTime",nextPushTime);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,20 @@
|
|||
package com.ljsd.jieling.logic.store.newRechargeInfo.bean;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
import config.SRechargeCommodityNewConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import util.TimeUtils;
|
||||
|
||||
public abstract class AbstractWelfareBag implements WelfareBag{
|
||||
public class AbstractWelfareBag extends MongoBase{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractWelfareBag.class);
|
||||
|
||||
private int roleId;
|
||||
private int modId;
|
||||
private int type;
|
||||
private long startTime;
|
||||
|
|
@ -20,23 +23,22 @@ public abstract class AbstractWelfareBag implements WelfareBag{
|
|||
private int dailyUpdate;
|
||||
private int continueDays;
|
||||
private boolean open;
|
||||
private boolean prohibited;//禁止的礼包
|
||||
private long lastBuyTime;
|
||||
private int buyTimes;
|
||||
private long refreshTime;
|
||||
private int[] privilege;
|
||||
private int timeType;
|
||||
@Transient
|
||||
private String[][] condition;
|
||||
private boolean isUserBuyRefresh;
|
||||
|
||||
public AbstractWelfareBag(SRechargeCommodityNewConfig config){
|
||||
modId = config.getId();
|
||||
type = config.getOtype();
|
||||
limit = config.getLimit();
|
||||
timeType = config.getTime();
|
||||
dailyUpdate = config.getDailyUpdate();
|
||||
continueDays = config.getContiueDays();
|
||||
privilege = config.getOpenPrivilege();
|
||||
public AbstractWelfareBag(User user,SRechargeCommodityNewConfig config){
|
||||
setModId(config.getId());
|
||||
setType(config.getOtype());
|
||||
setLimit(config.getLimit());
|
||||
setTimeType(config.getTime());
|
||||
setDailyUpdate(config.getDailyUpdate());
|
||||
setContinueDays(config.getContiueDays());
|
||||
setPrivilege(config.getOpenPrivilege());
|
||||
if(!config.getOnSaleRule().equals("")){
|
||||
String[] s = config.getOnSaleRule().split("\\|");
|
||||
condition = new String[s.length][3];
|
||||
|
|
@ -50,29 +52,45 @@ public abstract class AbstractWelfareBag implements WelfareBag{
|
|||
}
|
||||
i++;
|
||||
}
|
||||
setCondition(condition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh) {
|
||||
this.modId = modId;
|
||||
this.type = type;
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
this.limit = limit;
|
||||
this.dailyUpdate = dailyUpdate;
|
||||
this.continueDays = continueDays;
|
||||
this.open = open;
|
||||
this.lastBuyTime = lastBuyTime;
|
||||
this.buyTimes = buyTimes;
|
||||
this.refreshTime = refreshTime;
|
||||
this.privilege = privilege;
|
||||
this.timeType = timeType;
|
||||
this.condition = condition;
|
||||
this.isUserBuyRefresh = isUserBuyRefresh;
|
||||
}
|
||||
|
||||
public boolean buy() {
|
||||
if(!open){
|
||||
LOGGER.error("礼包:{}未开启",modId);
|
||||
return false;
|
||||
}
|
||||
if(prohibited){
|
||||
LOGGER.error("礼包:{}已被禁",modId);
|
||||
return false;
|
||||
}
|
||||
if(limit != 0 && buyTimes >=limit){
|
||||
LOGGER.error("礼包:{}购买次数为:{}超过限制:{}",modId,buyTimes,limit);
|
||||
return false;
|
||||
}
|
||||
buyTimes++;
|
||||
lastBuyTime = System.currentTimeMillis();
|
||||
if(isUserBuyRefresh){
|
||||
setRefreshTime(TimeUtils.getTodayZero() + getDailyUpdate() * TimeUtils.DAY);
|
||||
}
|
||||
setBuyTimes(getBuyTimes()+1);
|
||||
setLastBuyTime(System.currentTimeMillis());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String sendGoods() throws Exception{
|
||||
String rewardStr="";
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(modId);
|
||||
|
|
@ -113,6 +131,8 @@ public abstract class AbstractWelfareBag implements WelfareBag{
|
|||
}else if(getTimeType() == 8){//每月刷新
|
||||
setStartTime(TimeUtils.getCurMonthStartTime(1));
|
||||
setRefreshTime(TimeUtils.getMonthStartTime(1,1));
|
||||
}else if(getTimeType() == 5){//每月刷新
|
||||
setRefreshTime(0);
|
||||
}else{
|
||||
for(String[] I : getCondition()){
|
||||
if(I[0].equals("4")){
|
||||
|
|
@ -130,57 +150,90 @@ public abstract class AbstractWelfareBag implements WelfareBag{
|
|||
|
||||
public void setModId(int modId) {
|
||||
this.modId = modId;
|
||||
updateString("modId",modId);
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) { this.type = type; }
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
updateString("type",type);
|
||||
}
|
||||
|
||||
public boolean isOpen() { return open; }
|
||||
|
||||
public void setOpen(boolean open) { this.open = open; }
|
||||
|
||||
public boolean isProhibited() { return prohibited; }
|
||||
|
||||
public void setProhibited(boolean prohibited) { this.prohibited = prohibited; }
|
||||
public void setOpen(boolean open) {
|
||||
this.open = open;
|
||||
updateString("open",open);
|
||||
}
|
||||
|
||||
public String[][] getCondition() { return condition; }
|
||||
|
||||
public void setCondition(String[][] condition) { this.condition = condition; }
|
||||
public void setCondition(String[][] condition) {
|
||||
this.condition = condition;
|
||||
updateString("condition",condition);
|
||||
}
|
||||
|
||||
public long getStartTime() { return startTime; }
|
||||
|
||||
public void setStartTime(long startTime) { this.startTime = startTime; }
|
||||
public void setStartTime(long startTime) {
|
||||
this.startTime = startTime;
|
||||
updateString("startTime",startTime);
|
||||
}
|
||||
|
||||
public long getEndTime() { return endTime; }
|
||||
|
||||
public void setEndTime(long endTime) { this.endTime = endTime; }
|
||||
public void setEndTime(long endTime) {
|
||||
if(getModId() == 101){
|
||||
System.out.println();
|
||||
}
|
||||
this.endTime = endTime;
|
||||
updateString("endTime",endTime);
|
||||
}
|
||||
|
||||
public int getDailyUpdate() { return dailyUpdate; }
|
||||
|
||||
public void setDailyUpdate(int dailyUpdate) { this.dailyUpdate = dailyUpdate; }
|
||||
public void setDailyUpdate(int dailyUpdate) {
|
||||
this.dailyUpdate = dailyUpdate;
|
||||
updateString("dailyUpdate",dailyUpdate);
|
||||
}
|
||||
|
||||
public int getLimit() { return limit; }
|
||||
|
||||
public void setLimit(int limit) { this.limit = limit; }
|
||||
public void setLimit(int limit) {
|
||||
this.limit = limit;
|
||||
updateString("limit",limit);
|
||||
}
|
||||
|
||||
public int getBuyTimes() { return buyTimes; }
|
||||
|
||||
public void setBuyTimes(int buyTimes) { this.buyTimes = buyTimes; }
|
||||
public void setBuyTimes(int buyTimes) {
|
||||
this.buyTimes = buyTimes;
|
||||
updateString("buyTimes",buyTimes);
|
||||
}
|
||||
|
||||
public int getContinueDays() { return continueDays; }
|
||||
|
||||
public void setContinueDays(int continueDays) { this.continueDays = continueDays; }
|
||||
public void setContinueDays(int continueDays) {
|
||||
this.continueDays = continueDays;
|
||||
updateString("continueDays",continueDays);
|
||||
}
|
||||
|
||||
public long getRefreshTime() { return refreshTime; }
|
||||
|
||||
public void setRefreshTime(long refreshTime) { this.refreshTime = refreshTime; }
|
||||
public void setRefreshTime(long refreshTime) {
|
||||
this.refreshTime = refreshTime;
|
||||
updateString("refreshTime",refreshTime);
|
||||
}
|
||||
|
||||
public long getLastBuyTime() { return lastBuyTime; }
|
||||
|
||||
public void setLastBuyTime(long lastBuyTime) { this.lastBuyTime = lastBuyTime; }
|
||||
public void setLastBuyTime(long lastBuyTime) {
|
||||
this.lastBuyTime = lastBuyTime;
|
||||
updateString("lastBuyTime",lastBuyTime);
|
||||
}
|
||||
|
||||
public int[] getPrivilege() {
|
||||
return privilege;
|
||||
|
|
@ -188,6 +241,7 @@ public abstract class AbstractWelfareBag implements WelfareBag{
|
|||
|
||||
public void setPrivilege(int[] privilege) {
|
||||
this.privilege = privilege;
|
||||
updateString("privilege",privilege);
|
||||
}
|
||||
|
||||
public int getTimeType() {
|
||||
|
|
@ -196,5 +250,15 @@ public abstract class AbstractWelfareBag implements WelfareBag{
|
|||
|
||||
public void setTimeType(int timeType) {
|
||||
this.timeType = timeType;
|
||||
updateString("timeType",timeType);
|
||||
}
|
||||
|
||||
public boolean isUserBuyRefresh() {
|
||||
return isUserBuyRefresh;
|
||||
}
|
||||
|
||||
public void setUserBuyRefresh(boolean userBuyRefresh) {
|
||||
isUserBuyRefresh = userBuyRefresh;
|
||||
updateString("isUserBuyRefresh",isUserBuyRefresh);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.ljsd.jieling.logic.store.newRechargeInfo.bean;
|
|||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
import config.SRechargeCommodityNewConfig;
|
||||
import util.TimeUtils;
|
||||
|
||||
|
|
@ -11,7 +13,7 @@ import util.TimeUtils;
|
|||
public class PerpetualWelfareBag extends AbstractWelfareBag {
|
||||
|
||||
public PerpetualWelfareBag(User user, SRechargeCommodityNewConfig config) throws Exception{
|
||||
super(config);
|
||||
super(user,config);
|
||||
for(String[] I : getCondition()){
|
||||
if(I[0].equals("4")){
|
||||
if(config.getTime() == 1){//绝对时间
|
||||
|
|
@ -20,10 +22,18 @@ public class PerpetualWelfareBag extends AbstractWelfareBag {
|
|||
setStartTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(I[1]));
|
||||
}else if(config.getTime() == 3){//开服时间
|
||||
setStartTime(GameApplication.serverConfig.getCacheOpenTime());
|
||||
}else if(config.getTime() == 5){//开服时间开,玩家购买刷新
|
||||
setStartTime(GameApplication.serverConfig.getCacheOpenTime());
|
||||
setUserBuyRefresh(true);
|
||||
}else if(config.getTime() == 9){//条件达成
|
||||
setStartTime(0);
|
||||
}
|
||||
setEndTime(0);
|
||||
}
|
||||
}
|
||||
if(getDailyUpdate() > 0){
|
||||
setRefreshTime(getStartTime()+ getDailyUpdate() * TimeUtils.DAY);
|
||||
}
|
||||
if(config.getTime() == 7){//自然周
|
||||
setStartTime(TimeUtils.getCurWeekdayStartTime(1,0));
|
||||
setRefreshTime(TimeUtils.getCurWeekdayStartTime(1,0) + TimeUtils.WEEK);
|
||||
|
|
@ -33,4 +43,7 @@ public class PerpetualWelfareBag extends AbstractWelfareBag {
|
|||
}
|
||||
}
|
||||
|
||||
public PerpetualWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh) {
|
||||
super(modId, type, startTime, endTime, limit, dailyUpdate, continueDays, open, lastBuyTime, buyTimes, refreshTime, privilege, timeType, condition, isUserBuyRefresh);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.ljsd.jieling.logic.store.newRechargeInfo.bean;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
import config.SRechargeCommodityNewConfig;
|
||||
import util.TimeUtils;
|
||||
|
||||
|
|
@ -10,13 +12,17 @@ import util.TimeUtils;
|
|||
public class PushWelfareBag extends AbstractWelfareBag {
|
||||
|
||||
public PushWelfareBag(User user, SRechargeCommodityNewConfig config){
|
||||
super(config);
|
||||
super(user,config);
|
||||
setStartTime(System.currentTimeMillis());
|
||||
setEndTime(System.currentTimeMillis() + 2 * TimeUtils.HOUR);
|
||||
setOpen(true);
|
||||
user.getPlayerInfoManager().getNewRechargeInfo().addPush(this);
|
||||
}
|
||||
|
||||
public PushWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh) {
|
||||
super( modId, type, startTime, endTime, limit, dailyUpdate, continueDays, open, lastBuyTime, buyTimes, refreshTime, privilege, timeType, condition, isUserBuyRefresh);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buy() {
|
||||
setEndTime(System.currentTimeMillis());
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.ljsd.jieling.logic.store.newRechargeInfo.bean;
|
|||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
import config.SRechargeCommodityNewConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -14,7 +16,7 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
|
|||
private static final Logger LOGGER = LoggerFactory.getLogger(ReceiveWelfareBag.class);
|
||||
|
||||
public ReceiveWelfareBag(User user, SRechargeCommodityNewConfig config) throws Exception{
|
||||
super(config);
|
||||
super(user,config);
|
||||
for(String[] I : getCondition()){
|
||||
if(I[0].equals("4")){
|
||||
if(config.getTime() == 1){//绝对时间
|
||||
|
|
@ -38,6 +40,11 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
|
|||
}else{
|
||||
setEndTime(GameApplication.serverConfig.getCacheOpenTime()+Long.parseLong(I[2]));
|
||||
}
|
||||
}else if(config.getTime() == 5){//开服时间开,玩家购买刷新
|
||||
setStartTime(GameApplication.serverConfig.getCacheOpenTime());
|
||||
setUserBuyRefresh(true);
|
||||
}else if(config.getTime() == 9){//条件达成
|
||||
setStartTime(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -46,6 +53,11 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
|
|||
}
|
||||
}
|
||||
|
||||
public ReceiveWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh, boolean bought) {
|
||||
super( modId, type, startTime, endTime, limit, dailyUpdate, continueDays, open, lastBuyTime, buyTimes, refreshTime, privilege, timeType, condition, isUserBuyRefresh);
|
||||
this.bought = bought;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buy() {
|
||||
if(super.buy()){
|
||||
|
|
@ -54,8 +66,10 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
bought = true;
|
||||
setEndTime(TimeUtils.getTodayZero() + getContinueDays() * TimeUtils.DAY);
|
||||
setBought(true);
|
||||
if(getEndTime()!=0){
|
||||
setEndTime(TimeUtils.getTodayZero() + getContinueDays() * TimeUtils.DAY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -67,5 +81,17 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
|
|||
|
||||
public void setBought(boolean bought) {
|
||||
this.bought = bought;
|
||||
updateString("bought",bought);
|
||||
}
|
||||
|
||||
private long getRewardTime;
|
||||
|
||||
public long getGetRewardTime() {
|
||||
return getRewardTime;
|
||||
}
|
||||
|
||||
public void setGetRewardTime(long getRewardTime) {
|
||||
this.getRewardTime = getRewardTime;
|
||||
updateString("getRewardTime",getRewardTime);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
package com.ljsd.jieling.logic.store.newRechargeInfo.bean;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.KeyGenUtils;
|
||||
import com.ljsd.jieling.util.UUIDEnum;
|
||||
import config.SGlobalActivity;
|
||||
import config.SRechargeCommodityNewConfig;
|
||||
import util.TimeUtils;
|
||||
|
||||
/**
|
||||
* 时限礼包
|
||||
* 时限礼包(活动)
|
||||
*/
|
||||
public class TimeLimitWelfareBag extends AbstractWelfareBag {
|
||||
|
||||
public TimeLimitWelfareBag(User user, SRechargeCommodityNewConfig config) throws Exception{
|
||||
super(config);
|
||||
super(user,config);
|
||||
for(String[] I : getCondition()){
|
||||
if(I[0].equals("4")){
|
||||
if(config.getTime() == 1){//绝对时间
|
||||
setStartTime(TimeUtils.parseTimeToMiles(I[1],TimeUtils.Stand_CeHua_Data_format));
|
||||
setEndTime(TimeUtils.parseTimeToMiles(I[2],TimeUtils.Stand_CeHua_Data_format));
|
||||
}else if(config.getTime() == 2){//创角时间
|
||||
setStartTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(I[1]));
|
||||
setEndTime(user.getPlayerInfoManager().getCreateTime()+Long.parseLong(I[2]));
|
||||
}else if(config.getTime() == 3){//开服时间
|
||||
setStartTime(GameApplication.serverConfig.getCacheOpenTime()+Long.parseLong(I[1]));
|
||||
setEndTime(GameApplication.serverConfig.getCacheOpenTime()+Long.parseLong(I[2]));
|
||||
if(I[0].equals("3")){
|
||||
if(ActivityLogic.checkActivityOpen(user,Integer.parseInt(I[1]))){
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(Integer.parseInt(I[1]));
|
||||
setStartTime(sGlobalActivity.getStartTimeLong());
|
||||
setEndTime(sGlobalActivity.getEndTimeLong());
|
||||
setOpen(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(getDailyUpdate()>0 && getEndTime() != 0){
|
||||
setRefreshTime(getStartTime() + getDailyUpdate() * TimeUtils.DAY);
|
||||
}
|
||||
}
|
||||
|
||||
public TimeLimitWelfareBag(int modId, int type, long startTime, long endTime, int limit, int dailyUpdate, int continueDays, boolean open, long lastBuyTime, int buyTimes, long refreshTime, int[] privilege, int timeType, String[][] condition, boolean isUserBuyRefresh) {
|
||||
super(modId, type, startTime, endTime, limit, dailyUpdate, continueDays, open, lastBuyTime, buyTimes, refreshTime, privilege, timeType, condition, isUserBuyRefresh);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
|||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
||||
import config.SRechargeCommodityNewConfig;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -15,10 +16,10 @@ import java.util.Map;
|
|||
public abstract class AbstractRechargeHandler implements RechargeHandler {
|
||||
|
||||
@Override
|
||||
public boolean refreshStatus(User user,int rechargeId){
|
||||
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);
|
||||
return BuyGoodsNewLogic.refreshUnitWF(rechargeMap.get(rechargeId), user);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class PushHandler extends AbstractRechargeHandler {
|
|||
|
||||
@Override
|
||||
public AbstractWelfareBag initUnitWF(User user, SRechargeCommodityNewConfig config) {
|
||||
return new PushWelfareBag(config);
|
||||
return new PushWelfareBag(user,config);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,266 +1,266 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
import util.TimeUtils;
|
||||
import util.StringUtil;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Table(name ="RechargeCommodityConfig")
|
||||
public class SRechargeCommodityConfig implements BaseConfig {
|
||||
private int id;
|
||||
|
||||
private String rechargeId;
|
||||
|
||||
private String name;
|
||||
|
||||
private int type;
|
||||
|
||||
private double price;
|
||||
|
||||
private int[][] firstMultiple;
|
||||
|
||||
private int[][] baseReward;
|
||||
|
||||
private int[][][] extraReward;
|
||||
|
||||
private int limit;
|
||||
|
||||
private int firstInvest;
|
||||
|
||||
private int isDiscount;
|
||||
|
||||
private int[] discountType;
|
||||
|
||||
private int order;
|
||||
|
||||
private int accumulativeRecharge;
|
||||
|
||||
private int[][] playerLevel;
|
||||
|
||||
private int[] openPrivilege;
|
||||
|
||||
private int contiueDays;
|
||||
|
||||
private String rechargeId2;
|
||||
|
||||
private String rechargeId3;
|
||||
|
||||
private int time;
|
||||
private String startTime;
|
||||
private String endtime;
|
||||
|
||||
|
||||
private long startTimeLong;
|
||||
private long endTimeLong;
|
||||
|
||||
private int limitShow;
|
||||
|
||||
private int dailyUpdate;
|
||||
|
||||
private int[] passiveSkill;
|
||||
|
||||
private int showType;
|
||||
|
||||
public static Map<Integer, SRechargeCommodityConfig> rechargeCommodityConfigMap;
|
||||
public static Map<String, SRechargeCommodityConfig> sdkRechargeCommodityConfigMap;
|
||||
public static Map<Integer, SRechargeCommodityConfig> rechargeLevelMap;
|
||||
private static TreeMap<Double,Integer> recharegeHeroTime;
|
||||
public static TreeMap<Integer,Integer> rechargePlayerLevelMap;
|
||||
public static Set<SRechargeCommodityConfig> refreshItemInfo;
|
||||
|
||||
public static Map<Integer, Map<Integer, SRechargeCommodityConfig>> rechargeIndetions;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SRechargeCommodityConfig> config = STableManager.getConfig(SRechargeCommodityConfig.class);
|
||||
Map<Integer, SRechargeCommodityConfig> rechargeLevelMapTmp = new HashMap<>();
|
||||
|
||||
sdkRechargeCommodityConfigMap = new HashMap<>();
|
||||
|
||||
TreeMap<Double, Integer> recharegeHeroTimeTmp = new TreeMap<>();
|
||||
|
||||
TreeMap<Integer,Integer> rechargePlayerLevelTemp = new TreeMap<>();
|
||||
Set<SRechargeCommodityConfig> refreshItemInfoTmp = new HashSet<>();
|
||||
Map<Integer, Map<Integer, SRechargeCommodityConfig>> rechargeIndetionsTemp = new HashMap<>();
|
||||
for(SRechargeCommodityConfig sRechargeCommodityConfig : config.values()){
|
||||
sdkRechargeCommodityConfigMap.put(sRechargeCommodityConfig.getRechargeId(),sRechargeCommodityConfig);
|
||||
sdkRechargeCommodityConfigMap.put(sRechargeCommodityConfig.getRechargeId2(),sRechargeCommodityConfig);
|
||||
sdkRechargeCommodityConfigMap.put(sRechargeCommodityConfig.getRechargeId3(),sRechargeCommodityConfig);
|
||||
int[] discountType = sRechargeCommodityConfig.getDiscountType();
|
||||
if(discountType!=null && discountType.length>0 &&discountType[0] == 2){
|
||||
int level = discountType[1];
|
||||
rechargeLevelMapTmp.put(level,sRechargeCommodityConfig);
|
||||
}
|
||||
if(discountType!=null && discountType.length>0 &&sRechargeCommodityConfig.getTime()==4) {
|
||||
//五星成长礼初始化
|
||||
if (discountType[0] == 4&&sRechargeCommodityConfig.getDiscountType().length==4) {
|
||||
recharegeHeroTimeTmp.put((double)discountType[2], sRechargeCommodityConfig.getId());
|
||||
} else if (discountType[0] == 3) {
|
||||
rechargePlayerLevelTemp.put(discountType[1], sRechargeCommodityConfig.getId());
|
||||
}
|
||||
}
|
||||
if(sRechargeCommodityConfig.getDailyUpdate()>0){
|
||||
refreshItemInfoTmp.add(sRechargeCommodityConfig);
|
||||
}
|
||||
|
||||
int time = sRechargeCommodityConfig.getTime();
|
||||
String startTime = sRechargeCommodityConfig.getStartTime();
|
||||
String endtime = sRechargeCommodityConfig.getEndtime();
|
||||
if(time ==1 ){ // ActivityType.OPEN_TYPE_TIME
|
||||
if(!"0".equals(startTime)){
|
||||
sRechargeCommodityConfig.setStartTimeLong(TimeUtils.parseTimeToMiles(startTime,TimeUtils.Stand_CeHua_Data_format));
|
||||
}
|
||||
if(!"0".equals(endtime)){
|
||||
sRechargeCommodityConfig.setEndTimeLong(TimeUtils.parseTimeToMiles(endtime,TimeUtils.Stand_CeHua_Data_format));
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
if(!StringUtil.isEmpty(startTime)){
|
||||
sRechargeCommodityConfig.setStartTimeLong(Long.parseLong(startTime));
|
||||
}
|
||||
if(!StringUtil.isEmpty(endtime)){
|
||||
sRechargeCommodityConfig.setEndTimeLong(Long.parseLong(endtime));
|
||||
}
|
||||
if (sRechargeCommodityConfig.getShowType() == 25 || sRechargeCommodityConfig.getShowType() == 26) {
|
||||
if (!rechargeIndetionsTemp.containsKey(sRechargeCommodityConfig.getShowType())) {
|
||||
rechargeIndetionsTemp.put(sRechargeCommodityConfig.getShowType(), new HashMap<>());
|
||||
}
|
||||
rechargeIndetionsTemp.get(sRechargeCommodityConfig.getShowType()).put(sRechargeCommodityConfig.getId(), sRechargeCommodityConfig);
|
||||
}
|
||||
}
|
||||
rechargeCommodityConfigMap = config;
|
||||
rechargeLevelMap = rechargeLevelMapTmp;
|
||||
recharegeHeroTime = recharegeHeroTimeTmp;
|
||||
refreshItemInfo = refreshItemInfoTmp;
|
||||
rechargePlayerLevelMap = rechargePlayerLevelTemp;
|
||||
rechargeIndetions = rechargeIndetionsTemp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public int[][] getFirstMultiple() {
|
||||
return firstMultiple;
|
||||
}
|
||||
|
||||
public int[][] getBaseReward() {
|
||||
return baseReward;
|
||||
}
|
||||
|
||||
public int[][][] getExtraReward() {
|
||||
return extraReward;
|
||||
}
|
||||
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public int getFirstInvest() {
|
||||
return firstInvest;
|
||||
}
|
||||
|
||||
public int getIsDiscount() {
|
||||
return isDiscount;
|
||||
}
|
||||
|
||||
public int[] getDiscountType() {
|
||||
return discountType;
|
||||
}
|
||||
|
||||
public int getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public int getAccumulativeRecharge() {
|
||||
return accumulativeRecharge;
|
||||
}
|
||||
|
||||
public int[][] getPlayerLevel() {
|
||||
return playerLevel;
|
||||
}
|
||||
|
||||
public int[] getOpenPrivilege() {
|
||||
return openPrivilege;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public String getEndtime() {
|
||||
return endtime;
|
||||
}
|
||||
|
||||
public int getContiueDays() {
|
||||
return contiueDays;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setStartTimeLong(long startTimeLong) {
|
||||
this.startTimeLong = startTimeLong;
|
||||
}
|
||||
|
||||
public void setEndTimeLong(long endTimeLong) {
|
||||
this.endTimeLong = endTimeLong;
|
||||
}
|
||||
|
||||
public long getStartTimeLong() {
|
||||
return startTimeLong;
|
||||
}
|
||||
|
||||
public long getEndTimeLong() {
|
||||
return endTimeLong;
|
||||
}
|
||||
public int getLimitShow() {
|
||||
return limitShow;
|
||||
}
|
||||
|
||||
public int getDailyUpdate() {
|
||||
return dailyUpdate;
|
||||
}
|
||||
|
||||
public static TreeMap<Double, Integer> getRecharegeHeroTime() {
|
||||
return recharegeHeroTime;
|
||||
}
|
||||
|
||||
public static void setRecharegeHeroTime(TreeMap<Double, Integer> recharegeHeroTime) {
|
||||
SRechargeCommodityConfig.recharegeHeroTime = recharegeHeroTime;
|
||||
}
|
||||
|
||||
public String getRechargeId() {
|
||||
return rechargeId;
|
||||
}
|
||||
|
||||
public String getRechargeId2() {
|
||||
return rechargeId2;
|
||||
}
|
||||
|
||||
public String getRechargeId3() {
|
||||
return rechargeId3;
|
||||
}
|
||||
|
||||
public int getShowType() {
|
||||
return showType;
|
||||
}
|
||||
}
|
||||
//package config;
|
||||
//
|
||||
//import manager.STableManager;
|
||||
//import manager.Table;
|
||||
//import util.TimeUtils;
|
||||
//import util.StringUtil;
|
||||
//
|
||||
//import java.util.*;
|
||||
//
|
||||
//@Table(name ="RechargeCommodityConfig")
|
||||
//public class SRechargeCommodityConfig implements BaseConfig {
|
||||
// private int id;
|
||||
//
|
||||
// private String rechargeId;
|
||||
//
|
||||
// private String name;
|
||||
//
|
||||
// private int type;
|
||||
//
|
||||
// private double price;
|
||||
//
|
||||
// private int[][] firstMultiple;
|
||||
//
|
||||
// private int[][] baseReward;
|
||||
//
|
||||
// private int[][][] extraReward;
|
||||
//
|
||||
// private int limit;
|
||||
//
|
||||
// private int firstInvest;
|
||||
//
|
||||
// private int isDiscount;
|
||||
//
|
||||
// private int[] discountType;
|
||||
//
|
||||
// private int order;
|
||||
//
|
||||
// private int accumulativeRecharge;
|
||||
//
|
||||
// private int[][] playerLevel;
|
||||
//
|
||||
// private int[] openPrivilege;
|
||||
//
|
||||
// private int contiueDays;
|
||||
//
|
||||
// private String rechargeId2;
|
||||
//
|
||||
// private String rechargeId3;
|
||||
//
|
||||
// private int time;
|
||||
// private String startTime;
|
||||
// private String endtime;
|
||||
//
|
||||
//
|
||||
// private long startTimeLong;
|
||||
// private long endTimeLong;
|
||||
//
|
||||
// private int limitShow;
|
||||
//
|
||||
// private int dailyUpdate;
|
||||
//
|
||||
// private int[] passiveSkill;
|
||||
//
|
||||
// private int showType;
|
||||
//
|
||||
// public static Map<Integer, SRechargeCommodityConfig> rechargeCommodityConfigMap;
|
||||
// public static Map<String, SRechargeCommodityConfig> sdkRechargeCommodityConfigMap;
|
||||
// public static Map<Integer, SRechargeCommodityConfig> rechargeLevelMap;
|
||||
// private static TreeMap<Double,Integer> recharegeHeroTime;
|
||||
// public static TreeMap<Integer,Integer> rechargePlayerLevelMap;
|
||||
// public static Set<SRechargeCommodityConfig> refreshItemInfo;
|
||||
//
|
||||
// public static Map<Integer, Map<Integer, SRechargeCommodityConfig>> rechargeIndetions;//闯关,心魔
|
||||
//
|
||||
// @Override
|
||||
// public void init() throws Exception {
|
||||
// Map<Integer, SRechargeCommodityConfig> config = STableManager.getConfig(SRechargeCommodityConfig.class);
|
||||
// Map<Integer, SRechargeCommodityConfig> rechargeLevelMapTmp = new HashMap<>();
|
||||
//
|
||||
// sdkRechargeCommodityConfigMap = new HashMap<>();
|
||||
//
|
||||
// TreeMap<Double, Integer> recharegeHeroTimeTmp = new TreeMap<>();
|
||||
//
|
||||
// TreeMap<Integer,Integer> rechargePlayerLevelTemp = new TreeMap<>();
|
||||
// Set<SRechargeCommodityConfig> refreshItemInfoTmp = new HashSet<>();
|
||||
// Map<Integer, Map<Integer, SRechargeCommodityConfig>> rechargeIndetionsTemp = new HashMap<>();
|
||||
// for(SRechargeCommodityConfig sRechargeCommodityConfig : config.values()){
|
||||
// sdkRechargeCommodityConfigMap.put(sRechargeCommodityConfig.getRechargeId(),sRechargeCommodityConfig);
|
||||
// sdkRechargeCommodityConfigMap.put(sRechargeCommodityConfig.getRechargeId2(),sRechargeCommodityConfig);
|
||||
// sdkRechargeCommodityConfigMap.put(sRechargeCommodityConfig.getRechargeId3(),sRechargeCommodityConfig);
|
||||
// int[] discountType = sRechargeCommodityConfig.getDiscountType();
|
||||
// if(discountType!=null && discountType.length>0 &&discountType[0] == 2){
|
||||
// int level = discountType[1];
|
||||
// rechargeLevelMapTmp.put(level,sRechargeCommodityConfig);
|
||||
// }
|
||||
// if(discountType!=null && discountType.length>0 &&sRechargeCommodityConfig.getTime()==4) {
|
||||
// //五星成长礼初始化
|
||||
// if (discountType[0] == 4&&sRechargeCommodityConfig.getDiscountType().length==4) {
|
||||
// recharegeHeroTimeTmp.put((double)discountType[2], sRechargeCommodityConfig.getId());
|
||||
// } else if (discountType[0] == 3) {
|
||||
// rechargePlayerLevelTemp.put(discountType[1], sRechargeCommodityConfig.getId());
|
||||
// }
|
||||
// }
|
||||
// if(sRechargeCommodityConfig.getDailyUpdate()>0){
|
||||
// refreshItemInfoTmp.add(sRechargeCommodityConfig);
|
||||
// }
|
||||
//
|
||||
// int time = sRechargeCommodityConfig.getTime();
|
||||
// String startTime = sRechargeCommodityConfig.getStartTime();
|
||||
// String endtime = sRechargeCommodityConfig.getEndtime();
|
||||
// if(time ==1 ){ // ActivityType.OPEN_TYPE_TIME
|
||||
// if(!"0".equals(startTime)){
|
||||
// sRechargeCommodityConfig.setStartTimeLong(TimeUtils.parseTimeToMiles(startTime,TimeUtils.Stand_CeHua_Data_format));
|
||||
// }
|
||||
// if(!"0".equals(endtime)){
|
||||
// sRechargeCommodityConfig.setEndTimeLong(TimeUtils.parseTimeToMiles(endtime,TimeUtils.Stand_CeHua_Data_format));
|
||||
// }
|
||||
//
|
||||
// continue;
|
||||
// }
|
||||
// if(!StringUtil.isEmpty(startTime)){
|
||||
// sRechargeCommodityConfig.setStartTimeLong(Long.parseLong(startTime));
|
||||
// }
|
||||
// if(!StringUtil.isEmpty(endtime)){
|
||||
// sRechargeCommodityConfig.setEndTimeLong(Long.parseLong(endtime));
|
||||
// }
|
||||
// if (sRechargeCommodityConfig.getShowType() == 25 || sRechargeCommodityConfig.getShowType() == 26) {
|
||||
// if (!rechargeIndetionsTemp.containsKey(sRechargeCommodityConfig.getShowType())) {
|
||||
// rechargeIndetionsTemp.put(sRechargeCommodityConfig.getShowType(), new HashMap<>());
|
||||
// }
|
||||
// rechargeIndetionsTemp.get(sRechargeCommodityConfig.getShowType()).put(sRechargeCommodityConfig.getId(), sRechargeCommodityConfig);
|
||||
// }
|
||||
// }
|
||||
// rechargeCommodityConfigMap = config;
|
||||
// rechargeLevelMap = rechargeLevelMapTmp;
|
||||
// recharegeHeroTime = recharegeHeroTimeTmp;
|
||||
// refreshItemInfo = refreshItemInfoTmp;
|
||||
// rechargePlayerLevelMap = rechargePlayerLevelTemp;
|
||||
// rechargeIndetions = rechargeIndetionsTemp;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// public int getId() {
|
||||
// return id;
|
||||
// }
|
||||
//
|
||||
// public int getType() {
|
||||
// return type;
|
||||
// }
|
||||
//
|
||||
// public double getPrice() {
|
||||
// return price;
|
||||
// }
|
||||
//
|
||||
// public int[][] getFirstMultiple() {
|
||||
// return firstMultiple;
|
||||
// }
|
||||
//
|
||||
// public int[][] getBaseReward() {
|
||||
// return baseReward;
|
||||
// }
|
||||
//
|
||||
// public int[][][] getExtraReward() {
|
||||
// return extraReward;
|
||||
// }
|
||||
//
|
||||
// public int getLimit() {
|
||||
// return limit;
|
||||
// }
|
||||
//
|
||||
// public int getFirstInvest() {
|
||||
// return firstInvest;
|
||||
// }
|
||||
//
|
||||
// public int getIsDiscount() {
|
||||
// return isDiscount;
|
||||
// }
|
||||
//
|
||||
// public int[] getDiscountType() {
|
||||
// return discountType;
|
||||
// }
|
||||
//
|
||||
// public int getOrder() {
|
||||
// return order;
|
||||
// }
|
||||
//
|
||||
// public int getAccumulativeRecharge() {
|
||||
// return accumulativeRecharge;
|
||||
// }
|
||||
//
|
||||
// public int[][] getPlayerLevel() {
|
||||
// return playerLevel;
|
||||
// }
|
||||
//
|
||||
// public int[] getOpenPrivilege() {
|
||||
// return openPrivilege;
|
||||
// }
|
||||
//
|
||||
// public int getTime() {
|
||||
// return time;
|
||||
// }
|
||||
//
|
||||
// public String getStartTime() {
|
||||
// return startTime;
|
||||
// }
|
||||
//
|
||||
// public String getEndtime() {
|
||||
// return endtime;
|
||||
// }
|
||||
//
|
||||
// public int getContiueDays() {
|
||||
// return contiueDays;
|
||||
// }
|
||||
//
|
||||
// public String getName() {
|
||||
// return name;
|
||||
// }
|
||||
//
|
||||
// public void setStartTimeLong(long startTimeLong) {
|
||||
// this.startTimeLong = startTimeLong;
|
||||
// }
|
||||
//
|
||||
// public void setEndTimeLong(long endTimeLong) {
|
||||
// this.endTimeLong = endTimeLong;
|
||||
// }
|
||||
//
|
||||
// public long getStartTimeLong() {
|
||||
// return startTimeLong;
|
||||
// }
|
||||
//
|
||||
// public long getEndTimeLong() {
|
||||
// return endTimeLong;
|
||||
// }
|
||||
// public int getLimitShow() {
|
||||
// return limitShow;
|
||||
// }
|
||||
//
|
||||
// public int getDailyUpdate() {
|
||||
// return dailyUpdate;
|
||||
// }
|
||||
//
|
||||
// public static TreeMap<Double, Integer> getRecharegeHeroTime() {
|
||||
// return recharegeHeroTime;
|
||||
// }
|
||||
//
|
||||
// public static void setRecharegeHeroTime(TreeMap<Double, Integer> recharegeHeroTime) {
|
||||
// SRechargeCommodityConfig.recharegeHeroTime = recharegeHeroTime;
|
||||
// }
|
||||
//
|
||||
// public String getRechargeId() {
|
||||
// return rechargeId;
|
||||
// }
|
||||
//
|
||||
// public String getRechargeId2() {
|
||||
// return rechargeId2;
|
||||
// }
|
||||
//
|
||||
// public String getRechargeId3() {
|
||||
// return rechargeId3;
|
||||
// }
|
||||
//
|
||||
// public int getShowType() {
|
||||
// return showType;
|
||||
// }
|
||||
//}
|
||||
|
|
@ -405,7 +405,6 @@ public class MongoTest {
|
|||
if(userFOrce.containsKey(user.getId())){
|
||||
userFOrce.put(user.getId(),user.getPlayerInfoManager().getMaxForce());
|
||||
}
|
||||
System.out.println("the uid=" + user.getId() + " --- " + "amount = " + user.getPlayerInfoManager().getRechargeInfo().getSaveAmt() + "-- force" +user.getPlayerInfoManager().getMaxForce());
|
||||
});
|
||||
userFOrce.forEach((k,v)->{
|
||||
System.out.println(v);
|
||||
|
|
|
|||
Loading…
Reference in New Issue