新礼包测试

back_recharge
mengchengzhen 2021-04-22 13:55:20 +08:00
parent c48ad44e27
commit 7d91d069aa
39 changed files with 1800 additions and 1851 deletions

View File

@ -840,6 +840,23 @@ public class TimeUtils {
return c.getTimeInMillis();
}
/**
* x:
* next:
* 0
*/
public static long getMonthStartTime(int x,int next){
Calendar c = Calendar.getInstance();
c.setTime(new Date());
c.add(Calendar.MONTH,next);
c.set(Calendar.DAY_OF_MONTH, x);
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND,0);
c.set(Calendar.MILLISECOND, 0);
return c.getTimeInMillis();
}
/**
*
* @param targetWeekday

View File

@ -6,7 +6,7 @@ import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.MessageTypeProto;
import rpc.protocols.RoomProto;
@ -29,7 +29,7 @@ public class CoreService implements RPCRequestIFace.Iface {
public Result deliveryRecharge(int uid, String goodsId, String openId, String orderId, long orderTime, int amount) throws InvalidOperException, TException {
try {
LOGGER.info("deliveryRecharge start",uid );
return BuyGoodsLogic.sendGoods(uid, goodsId, openId, orderId, orderTime, amount);
return BuyGoodsNewLogic.sendGoods(uid, goodsId, openId, orderId, orderTime, amount);
} catch (Exception e) {
User user = UserManager.getUserInMem(uid);
Result result = new Result();
@ -57,7 +57,7 @@ public class CoreService implements RPCRequestIFace.Iface {
public RechargeResult getRecharge(int uid) throws TException {
try {
HashSet<Integer> integers = new HashSet<>();
BuyGoodsLogic.getGoodsBagInfoFromDelive(uid,integers);
// BuyGoodsLogic.getGoodsBagInfoFromDelive(uid,integers);
RechargeResult result = new RechargeResult();
result.setResultCode(1);
result.setSubNodeSet(integers);

View File

@ -38,7 +38,7 @@ public class Repot37EventUtil {
report37RoleLeveBean.setRole_grade_u_time(TimeUtils.getTimeStamp(System.currentTimeMillis()));
report37RoleLeveBean.setRole_grade_desc("null");
report37RoleLeveBean.setBalance("null");//todo
report37RoleLeveBean.setTotal_pay_amoun(String.valueOf(user.getPlayerInfoManager().getRechargeInfo().getSaveAmt()*100));
report37RoleLeveBean.setTotal_pay_amoun(String.valueOf(user.getPlayerInfoManager().getNewRechargeInfo().getRr()*100));
report37RoleLeveBean.setTotal_online_time(user.getPlayerInfoManager().getOnlineTime());
report37RoleLeveBean.setGuild_id("");//todo
report37RoleLeveBean.setGuild_name("0");//todo

View File

@ -189,7 +189,7 @@ public class GMRequestHandler extends BaseHandler{
int fightId = cUser.getMainLevelManager().getFightId();
SMainLevelConfig sMainLevelConfig = SMainLevelConfig.config.get(fightId);
if(sMainLevelConfig.getNextLevel() != -1){
MapLogic.getInstance().openNextMainLevel(cUser,fightId);
MapLogic.getInstance().openNextMainLevel(iSession,cUser,fightId);
}else{
break;
}
@ -219,7 +219,7 @@ public class GMRequestHandler extends BaseHandler{
while (!SMainLevelConfig.biggerThanFight(fightId,prarm1)){
SMainLevelConfig sMainLevelConfig = SMainLevelConfig.config.get(fightId);
if(sMainLevelConfig.getNextLevel() != -1){
MapLogic.getInstance().openNextMainLevel(cUser,fightId);
MapLogic.getInstance().openNextMainLevel(iSession,cUser,fightId);
}
fightId = sMainLevelConfig.getNextLevel();
}

View File

@ -21,8 +21,9 @@ import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.question.QuestionLogic;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.CommonProto;
@ -65,13 +66,12 @@ public class GetPlayerInfoHandler extends BaseHandler{
userId, token,msgId,msgIndex,getPlayerInfoRequest.getNum(),getPlayerInfoRequest.getStr());
User user = UserManager.getUser(userId);
PlayerLogic.getInstance().sendDayilyMail(user,-1);
QuestionLogic.getInstence().onLogin(user);
PlayerManager playerInfoManager = user.getPlayerInfoManager();
ActivityLogic.getInstance().flushForLogin(user,iSession);
GlobalDataManaager.checkNeedReFlush(iSession,user,null);
BuyGoodsLogic.initOwernBagInfo(user);
BuyGoodsNewLogic.refreshWelfareState(user);
// Poster.getPoster().dispatchEvent(new UserOnlineEvent(userId));
user.getUserMissionManager().onGameEvent(user, GameEvent.LOGIN_GAME,0);
long now = TimeUtils.now();
@ -116,7 +116,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
CommonProto.PlayerBindPhone playerBindPhone = CommonProto.PlayerBindPhone.newBuilder()
.setPhoneNum(user.getPlayerInfoManager().getPhoneBindInfo().getPhoneNum())
.setState(user.getPlayerInfoManager().getPhoneBindInfo().getState()).build();
RechargeInfo rechargeInfo = playerInfoManager.getRechargeInfo();
NewRechargeInfo newRechargeInfo = playerInfoManager.getNewRechargeInfo();
HeroManager heroManager = user.getHeroManager();
Map<Integer, Integer> totalCountMap = heroManager.getTotalCount();
int alreadyCount =0;
@ -127,15 +127,15 @@ 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());
}
// 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());
// }
//问卷状态
int questState =-1;
GlobalSystemControl globalSystemControl = GlobalSystemControl.getGlobalSystemControl();
@ -158,8 +158,8 @@ public class GetPlayerInfoHandler extends BaseHandler{
ServerConfig config = MongoUtil.getInstence().getMyMongoTemplate().findById(1, ServerConfig.class);
endless.setWorldLevel(config.getWorldLevel());
endless.setBloodScore(RedisUtil.getInstence().getZSetScore(RedisKey.BLOODY_RANK,Integer.toString(1), Integer.toString(userId)).intValue());
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
BuyGoodsLogic.getGoodsBagInfo(userId,goodsBagInfo,true);
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
BuyGoodsNewLogic.getGoodsBagInfo(userId,goodsBagInfo);
int vipPrivilageValue = user.getPlayerInfoManager().getVipPrivilageValue(SMazeTreasureSetting.sMazeTreasureSetting.getRefreshVIP());
SGameSetting setting = STableManager.getConfig(SGameSetting.class).get(1);
if(setting.getBornItem().length>0){
@ -183,10 +183,10 @@ public class GetPlayerInfoHandler extends BaseHandler{
PlayerLogic.getInstance().getMonthCardInfo(user);
int monthline = STableManager.getConfig(SMonthcardConfig.class).get(Global.MONTHCARDID).getPrice();
int lmonthline = STableManager.getConfig(SMonthcardConfig.class).get(Global.LMONTHCARDID).getPrice();
if(rechargeInfo.getMonthSaveAmt()>=monthline&&playerInfoManager.getMonthCard().getOrDefault(1,0)==0){
if(newRechargeInfo.getMonthRr()>=monthline&&playerInfoManager.getMonthCard().getOrDefault(1,0)==0){
user.getPlayerInfoManager().getMonthCard().put(Global.MONTHCARDID, (int) (System.currentTimeMillis() / 1000));
}
if(rechargeInfo.getSmonthSaveAmt()>=lmonthline&&playerInfoManager.getMonthCard().getOrDefault(2,0)==0){
if(newRechargeInfo.getsMonthRr()>=lmonthline&&playerInfoManager.getMonthCard().getOrDefault(2,0)==0){
user.getPlayerInfoManager().getMonthCard().put(Global.LMONTHCARDID, (int) (System.currentTimeMillis() / 1000));
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.RECHARGE_BUY.getType(),Global.LMONTHCARDID));
}
@ -197,14 +197,14 @@ public class GetPlayerInfoHandler extends BaseHandler{
.addAllNewPlayerGuidePoint(list)
.addAllPrivilege(privilegeList)
.addAllGiftGoodsInfo(goodsBagInfo)
.addAllBuyGoodsId(rechargeInfo.getBuyGoodsTimes().keySet())
// .addAllBuyGoodsId(rechargeInfo.getBuyGoodsTimes().keySet())
.setSuddenlyBossInfo(suddenlyBossInfo)
.addAllVipLeveTake(playerInfoManager.getHadTakeLevelBoxVip())
.setUserCreateTime((int)(playerInfoManager.getCreateTime()/1000))
.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())
@ -216,7 +216,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
.setQuestionState(questState)
.setSoulEquipPool(equipPool)
.addAllPlayedMapTypes(mapManager.getPlayedMapType())
.setAmount(rechargeInfo.getSaveAmt())
.setAmount(newRechargeInfo.getRr())
.setVipDaily(playerInfoManager.getHadTakeDailyBoxVip())
.setMissingRefreshCount(vipPrivilageValue)
.addAllMonthinfos(PlayerLogic.getInstance().getMonthCardInfo(user))

View File

@ -23,7 +23,6 @@ public class ServerZeroHandler extends BaseHandler {
public void process(ISession session, PacketNetData netData) throws Exception {
User user = UserManager.getUser(session.getUid());
GlobalDataManaager.flushGoodsTimes(user);
PlayerLogic.getInstance().sendDayilyMail(user,-1);
user.getUserMissionManager().onGameEvent(user, GameEvent.LOGIN_GAME,0);
GlobalDataManaager.checkNeedReFlush(session, UserManager.getUser(session.getUid()), PlayerInfoProto.FivePlayerUpdateIndication.newBuilder());

View File

@ -40,7 +40,7 @@ import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
import com.ljsd.jieling.logic.rank.RankContext;
import com.ljsd.jieling.logic.rank.RankEnum;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.logic.store.StoreType;
@ -1396,12 +1396,12 @@ public class MapLogic {
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fastFightResponse.build(), true);
}
/**
*
*
* @param session
* @param messageType
*/
// /**
// * 开始战斗
// *
// * @param session
// * @param messageType
// */
// public void startFight(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
// int uid = session.getUid();
// User user = UserManager.getUser(uid);
@ -2104,11 +2104,12 @@ public class MapLogic {
if (resultCode == -1) {
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
} else if (resultCode == 0) {
user.getPlayerInfoManager().getNewRechargeInfo().addMainLineLost();
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
return;
}
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMainLevelConfig.getReward(), 1, 0, BIReason.LEVELDIFFICULTY_FIGHT_REWARD);
openNextMainLevel(user, fightId);
openNextMainLevel(session,user, fightId);
FightInfoProto.FightEndResponse.Builder fightEndResponse = FightInfoProto.FightEndResponse.newBuilder();
fightEndResponse.setEnventDrop(drop);
fightEndResponse.setResult(resultCode);
@ -2119,9 +2120,6 @@ public class MapLogic {
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
int integerValue = SSpecialConfig.getIntegerValue(SSpecialConfig.DISCOUNT_MAIN);
if (sMainLevelConfig.getSortId() % integerValue == 0) {
openRechargeBagIds(session, user, 25);
}
// String rankKey = RedisKey.getKey(RedisKey.MAINLEVEL_RANK, "", false);
// RedisUtil.getInstence().zsetAddOne(rankKey, String.valueOf(user.getId()), sMainLevelConfig.getVirtureId());
@ -2130,48 +2128,8 @@ public class MapLogic {
}
/**
*
* @param session
* @param user
* @param type
* @throws Exception
*/
public void openRechargeBagIds(ISession session, User user, int type) throws Exception {
Map<Integer, SRechargeCommodityConfig> integerSRechargeCommodityConfigMap = SRechargeCommodityConfig.rechargeIndetions.get(type);
if (integerSRechargeCommodityConfigMap == null || integerSRechargeCommodityConfigMap.isEmpty()) {
return;
}
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
double saveAmt = rechargeInfo.getSaveAmt();
int sendRechargeId = 0;
long lastTime = 0;
for (SRechargeCommodityConfig sRechargeCommodityConfig : integerSRechargeCommodityConfigMap.values()) {
if (saveAmt >= sRechargeCommodityConfig.getDiscountType()[1] && saveAmt <= sRechargeCommodityConfig.getDiscountType()[2]) {
sendRechargeId = sRechargeCommodityConfig.getId();
lastTime = sRechargeCommodityConfig.getDiscountType()[3] * 3600 * 1000L;
break;
}
}
if (sendRechargeId == 0) {
LOGGER.info("sendRechargeId indetion id==0 uid=>{} saveAmt=>{}", user.getId(), saveAmt);
} else {
if (!rechargeInfo.getBuyGoodsTimes().containsKey(sendRechargeId)) {
rechargeInfo.updateBuyGoodsTimes(sendRechargeId, 0);
rechargeInfo.putDyGoodsCanBuyTimes(sendRechargeId, 1);
} else {
rechargeInfo.putDyGoodsCanBuyTimes(sendRechargeId, rechargeInfo.getDyGoodsCanBuyTimes().get(sendRechargeId) + 1);
}
rechargeInfo.updateRefreshMapByKey(sendRechargeId, TimeUtils.now() + lastTime);
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
BuyGoodsLogic.getGoodsBagInfo(user.getId(), goodsBagInfo, false);
PlayerInfoProto.AllGiftGoodsIndication goodsBuild = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, goodsBuild, true);
}
}
public void openNextMainLevel(User user,int fightId) throws Exception {
public void openNextMainLevel(ISession session,User user,int fightId) throws Exception {
int level = user.getPlayerInfoManager().getLevel();
int state = 1;
int updateFightId = fightId;
@ -2188,6 +2146,7 @@ public class MapLogic {
Poster.getPoster().dispatchEvent(new FightMainEvent(user.getId(),fightId));
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.LEVEL_FIGHT.getType(),fightId));
user.getMainLevelManager().updateFight(updateFightId,state);
BuyGoodsNewLogic.openPush(session,user,1,fightId);
if(state == -1){
//删除为0的
Map<Integer, Integer> fightStateInfo = user.getMainLevelManager().getFightStateInfo();
@ -2281,6 +2240,7 @@ public class MapLogic {
if (resultCode == -1) {
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
} else if (resultCode == 0) {
user.getPlayerInfoManager().getNewRechargeInfo().addTowerLost();
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
FightInfoProto.FightEndResponse fightEndResponse = FightInfoProto.FightEndResponse
.newBuilder()
@ -2291,7 +2251,7 @@ public class MapLogic {
ReportUtil.onReportEvent(user,ReportEventEnum.COMPLETE_XINMO.getType(),checkFightId,sFloodConfig.getMonster(),MonsterUtil.getMonsterForce(new int[]{sFloodConfig.getMonster()}),new Date(),"",null,null,"失败");
return;
}
BuyGoodsNewLogic.openPush(session,user,2,sFloodConfig.getId());
//排行榜
// String rankKey = RedisKey.getKey(RedisKey.MONSTER_ATTACK_RANK,"", false);
// RedisUtil.getInstence().zsetAddOneOffsetByTime(rankKey, String.valueOf(user.getId()), checkFightId);
@ -2320,9 +2280,6 @@ public class MapLogic {
ifTreer = true;
}
}
if (ifTreer) {
openRechargeBagIds(session, user, 26);
}
}
List<CommonProto.Item> itemDrop = drop.getItemlistList();
List<Integer> itemIdList = new ArrayList<>();
@ -2805,7 +2762,7 @@ public class MapLogic {
/**
*
* @param session
* @param uid
* @throws Exception
*/
public void clearEndLessDrop(int uid) throws Exception {

View File

@ -1,7 +1,7 @@
package com.ljsd.jieling.handler.store;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.MessageTypeProto;
@ -20,6 +20,6 @@ public class TestBuyGiftGoodsHandler extends BaseHandler {
PlayerInfoProto.TestBuyGiftGoodsRequest testBuyGiftGoodsRequest = PlayerInfoProto.TestBuyGiftGoodsRequest.parseFrom(netData.parseClientProtoNetData());
int goodsId = testBuyGiftGoodsRequest.getGoodsId();
BuyGoodsLogic.testBuyGoods(iSession,String.valueOf(goodsId));
BuyGoodsNewLogic.testBuyGoods(iSession,String.valueOf(goodsId));
}
}

View File

@ -11,7 +11,6 @@ import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.item.ItemLog;
import com.ljsd.jieling.logic.item.ItemLogic;
import config.SGlobalActivity;
import config.SRechargeCommodityConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import util.TimeUtils;

View File

@ -19,10 +19,10 @@ public class ChargeAmountEventHandler extends CommonEventHandler {
Map<String, Object> setOnceProperties = new HashMap<>();
setProperties.put("charge_amount",user.getPlayerInfoManager().getRechargeInfo().getSaveAmt());
setProperties.put("charge_amount",user.getPlayerInfoManager().getNewRechargeInfo().getRr());
setProperties.put("last_recharge_time",new Date());
setOnceProperties.put("first_charge_time",new Date());
setOnceProperties.put("first_charge_amount",user.getPlayerInfoManager().getRechargeInfo().getSaveAmt());
setOnceProperties.put("first_charge_amount",user.getPlayerInfoManager().getNewRechargeInfo().getRr());
userProperties.put(1,setProperties);
userProperties.put(2,setOnceProperties);
return userProperties;

View File

@ -31,7 +31,7 @@ import com.ljsd.jieling.logic.mission.GameMisionType;
import com.ljsd.jieling.logic.mission.data.DataManagerDistributor;
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.netty.cocdex.Tea;
@ -48,7 +48,6 @@ import com.ljsd.jieling.util.MessageUtil;
import config.SDailyTasksConfig;
import config.SEndlessDifficulty;
import config.SGlobalSystemConfig;
import config.SRechargeCommodityConfig;
import manager.STableManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -337,7 +336,7 @@ public class GlobalDataManaager implements IManager {
PlayerLogic.getInstance().vipflushEveryDay(user,fBuilder);
PlayerLogic.getInstance().flushUserdataEvery(user,fBuilder);
GuildLogic.getInstance().flushEveryDay(user,fBuilder);
BuyGoodsLogic.flushEveryDay(user);
BuyGoodsNewLogic.refreshWelfareState(user);
ExpeditionLogic.getInstance().flushUserdataEveryDay(user);
user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_REFRESH,0);
// user.getUserMissionManager().onGameEvent(user, GameEvent.BLOODY_REFRESH,0);
@ -373,72 +372,14 @@ public class GlobalDataManaager implements IManager {
// 道具刷新
flushGoodsTimes(user);
BuyGoodsLogic.flushEveryDay(user);
BuyGoodsNewLogic.refreshWelfareState(user);
user.getUserMissionManager().onGameEvent(user, GameEvent.LOGIN_GAME,0);
}
user.getPlayerInfoManager().setLoginTime(TimeUtils.now());
}
public static void flushGoodsTimes(User user){
Map<Integer, Integer> buyGoodsTimes = user.getPlayerInfoManager().getRechargeInfo().getBuyGoodsTimes();
boolean update = false;
long now = TimeUtils.now();
Map<Integer, Long> refreshBagMap = user.getPlayerInfoManager().getRechargeInfo().getRefreshBagMap();
Iterator<Map.Entry<Integer, Long>> iterator = refreshBagMap.entrySet().iterator();
Set<Integer> updateBuyTimesGoodsId = new HashSet<>();
while (iterator.hasNext()){
Map.Entry<Integer, Long> next = iterator.next();
if(next.getValue()<=now){
updateBuyTimesGoodsId.add(next.getKey());
long endTime = next.getValue();
boolean isMiss =false; //移除清除的配置 线上错误避免
int tt =0;
while (endTime<now){
tt++;
SRechargeCommodityConfig sRechargeCommodityConfig = SRechargeCommodityConfig.rechargeCommodityConfigMap.get(next.getKey());
if(null==sRechargeCommodityConfig){
isMiss =true;
LOGGER.error("Exception旧配置删除请检查"+next.getKey());
break;
}
if(sRechargeCommodityConfig.getDailyUpdate()==0){
isMiss =true;
LOGGER.error("Exception配置"+next.getKey()+"endTime"+endTime+"sRe"+sRechargeCommodityConfig.getDailyUpdate());
break;
}
if(tt>1000){
isMiss =true;
LOGGER.error("Exception配置"+next.getKey()+"endTime"+endTime+"sRe"+sRechargeCommodityConfig.getDailyUpdate());
break;
}
endTime += sRechargeCommodityConfig.getDailyUpdate() * TimeUtils.ONE_DAY ;
}
if(isMiss){
iterator.remove();
}else {
refreshBagMap.put(next.getKey(),endTime);
update =true;
}
}
}
if(update){
if(buyGoodsTimes!=null && !buyGoodsTimes.isEmpty()){
updateBuyTimesGoodsId.forEach(e->{
if(buyGoodsTimes.containsKey(e)){
buyGoodsTimes.put(e,0);
}
});
user.getPlayerInfoManager().getRechargeInfo().clearCacheSendId();
user.getPlayerInfoManager().getRechargeInfo().setBuyGoodsTimes(buyGoodsTimes);
}
user.getPlayerInfoManager().getRechargeInfo().setRefreshBagMap(refreshBagMap);
}
BuyGoodsNewLogic.refreshWelfareState(user);
}
public static void everTask(int hour){

View File

@ -88,7 +88,7 @@ public class ActivityLogic implements IEventHandler{
//更新每日累计充值
ActivityLogic.getInstance().resumeActivity(user, ActivityType.RECHARGE_NUM);
//更新首日充值st
user.getPlayerInfoManager().getRechargeInfo().setDailyFirst(0);
// user.getPlayerInfoManager().getNewRechargeInfo().setDailyFirst(0);
//更新累计充值天数
ActivityLogic.getInstance().resumeActivity(user, ActivityType.RECHARGE_SUM_DAY);

View File

@ -4,6 +4,7 @@ import com.ljsd.jieling.jbean.ActivityMission;
import com.ljsd.jieling.jbean.ActivityProgressInfo;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
import com.ljsd.jieling.network.session.ISession;
import config.SActivityRewardConfig;
import config.SGlobalActivity;
@ -23,8 +24,9 @@ class GrowthFundActivity extends AbstractActivity {
int[][] values = sActivityRewardConfig.getValues();
User user = UserManager.getUser(session.getUid());
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
Integer buyTimes = user.getPlayerInfoManager().getRechargeInfo().getBuyGoodsTimes().getOrDefault(sGlobalActivity.getCanBuyRechargeId()[0], 0);
if(buyTimes == 0){
ReceiveWelfareBag bag = user.getPlayerInfoManager().getNewRechargeInfo().getReceiveMap().get(sGlobalActivity.getCanBuyRechargeId()[0]);
Integer buyTimes = bag.getBuyTimes();
if(buyTimes == 0){
return false;
}
int type = values[0][0];
@ -42,10 +44,10 @@ class GrowthFundActivity extends AbstractActivity {
@Override
public void onActivityEndOnMySelf(User user) throws Exception {
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
if(sGlobalActivity.getCanBuyRechargeId()!=null&&sGlobalActivity.getCanBuyRechargeId().length>0){
Arrays.stream(sGlobalActivity.getCanBuyRechargeId()).forEach(n->user.getPlayerInfoManager().getRechargeInfo().updateBuyGoodsTimes(n,0));
}
// SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
// if(sGlobalActivity.getCanBuyRechargeId()!=null&&sGlobalActivity.getCanBuyRechargeId().length>0){
// Arrays.stream(sGlobalActivity.getCanBuyRechargeId()).forEach(n->user.getPlayerInfoManager().getRechargeInfo().updateBuyGoodsTimes(n,0));
// }
}
@Override

View File

@ -1,9 +1,9 @@
package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.jbean.ActivityProgressInfo;
import com.ljsd.jieling.logic.dao.RechargeInfo;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
import com.ljsd.jieling.network.session.ISession;
import config.SActivityRewardConfig;
import util.TimeUtils;
@ -20,8 +20,8 @@ class RechargeTotalActivity extends AbstractActivity {
int missionProgress = activityProgressInfo.getProgrss();
long now = TimeUtils.now();
User user = UserManager.getUser(session.getUid());
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
int days = TimeUtils.differentDaysByHour(rechargeInfo.getCreateTime(), now,0) + 1;
NewRechargeInfo rechargeInfo = user.getPlayerInfoManager().getNewRechargeInfo();
int days = TimeUtils.differentDaysByHour(rechargeInfo.getFirstTime(), now,0) + 1;
if (missionProgress <= 0 || days < values[0][1]) {
return false;
}

View File

@ -47,12 +47,12 @@ public class TreasureActivity extends AbstractActivity {
LOGGER.info("[青龙秘宝初始化] [重置秘宝解锁状态] [uid:{}]",user.getId());
user.getPlayerInfoManager().setHadBuyTreasure(0);
int id=0;
for(SRechargeCommodityConfig sRechargeCommodityConfig : SRechargeCommodityConfig.rechargeCommodityConfigMap.values()){
for(SRechargeCommodityNewConfig sRechargeCommodityConfig : SRechargeCommodityNewConfig.configMap.values()){
if(sRechargeCommodityConfig.getType() == GiftGoodsType.SUN_LONG){
id=sRechargeCommodityConfig.getId();
}
}
user.getPlayerInfoManager().getRechargeInfo().updateBuyGoodsTimes(id,0);
// user.getPlayerInfoManager().getRechargeInfo().updateBuyGoodsTimes(id,0);
}
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);

View File

@ -8,7 +8,7 @@ import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.util.ToolsUtil;
import config.SGlobalActivity;
@ -39,11 +39,11 @@ public class ActivityStateChangeHandler implements IEventHandler {
ActivityLogic.getInstance().checkNeedOpenStore(user,shopId,startTime,endTime);
}
}
if(sGlobalActivity.getCanBuyRechargeId()!=null&&sGlobalActivity.getCanBuyRechargeId().length>0){
Arrays.stream(sGlobalActivity.getCanBuyRechargeId()).forEach(n->user.getPlayerInfoManager().getRechargeInfo().putDyGoodsCanBuyTimes(n,1));
BuyGoodsLogic.sendGiftGooodsIndication(uid);
}
// if(sGlobalActivity.getCanBuyRechargeId()!=null&&sGlobalActivity.getCanBuyRechargeId().length>0){
//
// Arrays.stream(sGlobalActivity.getCanBuyRechargeId()).forEach(n->user.getPlayerInfoManager().getRechargeInfo().putDyGoodsCanBuyTimes(n,1));
// BuyGoodsNewLogic.sendGiftGooodsIndication(uid);
// }
}else if(state == ActivityType.FINISH_STATE){
List<SGlobalActivity> sGlobalActivities = SGlobalActivity.sGlobalActivityMapByOpenRules.getOrDefault(3, new ArrayList<>(0));
sGlobalActivities.stream().filter(s->s.getOpenRules()[1] == activityId).forEach(s->{

View File

@ -7,15 +7,14 @@ import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.IEventHandler;
import com.ljsd.jieling.logic.activity.event.HeroFiveStarGetEvent;
import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.dao.RechargeInfo;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.CommonProto;
import rpc.protocols.MessageTypeProto;
import rpc.protocols.PlayerInfoProto;
import config.SRechargeCommodityConfig;
import java.util.ArrayList;
import java.util.List;
@ -38,46 +37,8 @@ public class HeroFiveStarGetEventHandler implements IEventHandler {
}
//动态控制购买数量
User user = UserManager.getUser(((HeroFiveStarGetEvent) event).getUid());
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
double saveAmt = rechargeInfo.getSaveAmt();
long now = System.currentTimeMillis();
Map<Integer, Long> typeBagMap = rechargeInfo.getTypeBagMap();
Map.Entry<Double, Integer> entry = SRechargeCommodityConfig.getRecharegeHeroTime().ceilingEntry(saveAmt);
if(entry==null){
return;
}
int goodsId =entry.getValue();
if(goodsId!=0){
if(typeBagMap.containsKey(goodsId)){
long lasttime = rechargeInfo.getTypeBagMap().get(goodsId);
int diffHourTemp = (int) ((now - lasttime) / 3600 / 1000);
//做一个验证如果前一次的成长礼没有超出购买时间才增加次数否则重置为1次
if (diffHourTemp < 2) {
rechargeInfo.addDyGoodsCanBuyTimes(goodsId);
}else {
rechargeInfo.putDyGoodsCanBuyTimes(goodsId,1);
}
}else {
rechargeInfo.putDyGoodsCanBuyTimes(goodsId,1);
}
}else {
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
rechargeInfo.addTypeBagMap(goodsId,System.currentTimeMillis());
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
BuyGoodsLogic.getGoodsBagInfo(user.getId(), goodsBagInfo,false);
int star = ((HeroFiveStarGetEvent) event).getStar();
ISession session = OnlineUserManager.getSessionByUid(user.getId());
if(session!=null){
if(null!= SimpleTransaction.current()){
//获得多个英雄进行协议合并
PlayerInfoProto.AllGiftGoodsIndication.Builder build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo);
SimpleTransaction.current().dealWhileCommit(new SimpleTransaction.SendTask(build.build(), MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE));
}
}
BuyGoodsNewLogic.openPush(session,user,4,star);
}
}

View File

@ -1,93 +1,93 @@
package com.ljsd.jieling.logic.activity.eventhandler;
import com.ljsd.jieling.core.SimpleTransaction;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.IEventHandler;
import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.activity.event.UserLevelEvent;
import com.ljsd.jieling.logic.dao.RechargeInfo;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.CommonProto;
import rpc.protocols.MessageTypeProto;
import rpc.protocols.PlayerInfoProto;
import config.SRechargeCommodityConfig;
import config.SSpecialConfig;
import manager.STableManager;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Description:
* Author: zsx
* CreateDate: 2020/6/15 11:51
*/
public class LeveGiftEventHander implements IEventHandler {
@Override
public void onEvent(IEvent event) throws Exception {
if(event instanceof UserLevelEvent){
User user = UserManager.getUser(((UserLevelEvent) event).getUid());
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
int[] shenZhuangRule = SSpecialConfig.getOnceArrayValue(SSpecialConfig.SHEN_ZHUANG);
if(shenZhuangRule!=null&&shenZhuangRule.length>0&&((UserLevelEvent) event).getLevel()==shenZhuangRule[0]){
rechargeInfo.addDyGoodsCanBuyTimes(10001);
rechargeInfo.putLevelAndMoneyBagMap(-1,System.currentTimeMillis());
// rechargeInfo.putLevelAndMoneyBagMap(shenZhuangRule[1],System.currentTimeMillis());
giftIndication(user,new ArrayList<>(1));
}
int[] onceArrayValue = SSpecialConfig.getOnceArrayValue(SSpecialConfig.DISCOUNT_LEVEL);
int start = onceArrayValue[0];
int inter = onceArrayValue[1];
if(((UserLevelEvent) event).getLevel()<start){
return;
}
boolean b = (((UserLevelEvent) event).getLevel() - start) % inter == 0;
if(!b){
return;
}
double saveAmt = rechargeInfo.getSaveAmt();
Map.Entry<Integer, Integer> entry = SRechargeCommodityConfig.rechargePlayerLevelMap.floorEntry((int)saveAmt);
SRechargeCommodityConfig orDefault = STableManager.getConfig(SRechargeCommodityConfig.class).getOrDefault(entry.getValue(), null);
if(orDefault==null){
return;
}
if(rechargeInfo.getLevelAndMoneyBagMap().containsKey(entry.getKey())){
long lasttime = rechargeInfo.getLevelAndMoneyBagMap().get(entry.getKey());
long i = orDefault.getDiscountType()[3] * 3600*1000L;
if(System.currentTimeMillis()-lasttime<i){
rechargeInfo.addDyGoodsCanBuyTimes(orDefault.getId());
}else {
rechargeInfo.putDyGoodsCanBuyTimes(orDefault.getId(),1);
}
}else {
rechargeInfo.putDyGoodsCanBuyTimes(orDefault.getId(),1);
}
rechargeInfo.putLevelAndMoneyBagMap(entry.getKey(),System.currentTimeMillis());
// BuyGoodsLogic.sendGiftGooodsIndication(user.getId());
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
giftIndication(user,goodsBagInfo);
}
}
private void giftIndication(User user,List<CommonProto.GiftGoodsInfo> goodsBagInfo) throws Exception {
BuyGoodsLogic.getGoodsBagInfo(user.getId(), goodsBagInfo,false);
ISession session = OnlineUserManager.getSessionByUid(user.getId());
if(session!=null){
if(null!= SimpleTransaction.current()){
//获得多个英雄进行协议合并
PlayerInfoProto.AllGiftGoodsIndication.Builder build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo);
SimpleTransaction.current().dealWhileCommit(new SimpleTransaction.SendTask(build.build(), MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE));
}
}
}
}
//package com.ljsd.jieling.logic.activity.eventhandler;
//
//import com.ljsd.jieling.core.SimpleTransaction;
//import com.ljsd.jieling.logic.OnlineUserManager;
//import com.ljsd.jieling.logic.activity.IEventHandler;
//import com.ljsd.jieling.logic.activity.event.IEvent;
//import com.ljsd.jieling.logic.activity.event.UserLevelEvent;
//import com.ljsd.jieling.logic.dao.RechargeInfo;
//import com.ljsd.jieling.logic.dao.UserManager;
//import com.ljsd.jieling.logic.dao.root.User;
//import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
//import com.ljsd.jieling.network.session.ISession;
//import rpc.protocols.CommonProto;
//import rpc.protocols.MessageTypeProto;
//import rpc.protocols.PlayerInfoProto;
//import config.SRechargeCommodityConfig;
//import config.SSpecialConfig;
//import manager.STableManager;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Map;
//
///**
// * Description: 等级礼包
// * Author: zsx
// * CreateDate: 2020/6/15 11:51
// */
//public class LeveGiftEventHander implements IEventHandler {
//
// @Override
// public void onEvent(IEvent event) throws Exception {
//
// if(event instanceof UserLevelEvent){
// User user = UserManager.getUser(((UserLevelEvent) event).getUid());
// RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
// int[] shenZhuangRule = SSpecialConfig.getOnceArrayValue(SSpecialConfig.SHEN_ZHUANG);
// if(shenZhuangRule!=null&&shenZhuangRule.length>0&&((UserLevelEvent) event).getLevel()==shenZhuangRule[0]){
// rechargeInfo.addDyGoodsCanBuyTimes(10001);
// rechargeInfo.putLevelAndMoneyBagMap(-1,System.currentTimeMillis());
//
//// rechargeInfo.putLevelAndMoneyBagMap(shenZhuangRule[1],System.currentTimeMillis());
// giftIndication(user,new ArrayList<>(1));
// }
// int[] onceArrayValue = SSpecialConfig.getOnceArrayValue(SSpecialConfig.DISCOUNT_LEVEL);
// int start = onceArrayValue[0];
// int inter = onceArrayValue[1];
// if(((UserLevelEvent) event).getLevel()<start){
// return;
// }
// boolean b = (((UserLevelEvent) event).getLevel() - start) % inter == 0;
// if(!b){
// return;
// }
// double saveAmt = rechargeInfo.getSaveAmt();
// Map.Entry<Integer, Integer> entry = SRechargeCommodityConfig.rechargePlayerLevelMap.floorEntry((int)saveAmt);
// SRechargeCommodityConfig orDefault = STableManager.getConfig(SRechargeCommodityConfig.class).getOrDefault(entry.getValue(), null);
// if(orDefault==null){
// return;
// }
//
// if(rechargeInfo.getLevelAndMoneyBagMap().containsKey(entry.getKey())){
// long lasttime = rechargeInfo.getLevelAndMoneyBagMap().get(entry.getKey());
// long i = orDefault.getDiscountType()[3] * 3600*1000L;
// if(System.currentTimeMillis()-lasttime<i){
// rechargeInfo.addDyGoodsCanBuyTimes(orDefault.getId());
// }else {
// rechargeInfo.putDyGoodsCanBuyTimes(orDefault.getId(),1);
// }
// }else {
// rechargeInfo.putDyGoodsCanBuyTimes(orDefault.getId(),1);
// }
//
// rechargeInfo.putLevelAndMoneyBagMap(entry.getKey(),System.currentTimeMillis());
// // BuyGoodsLogic.sendGiftGooodsIndication(user.getId());
//
// List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
// giftIndication(user,goodsBagInfo);
// }
// }
//
// private void giftIndication(User user,List<CommonProto.GiftGoodsInfo> goodsBagInfo) throws Exception {
// BuyGoodsNewLogic.getGoodsBagInfo(user.getId(), goodsBagInfo);
// ISession session = OnlineUserManager.getSessionByUid(user.getId());
// if(session!=null){
// if(null!= SimpleTransaction.current()){
// //获得多个英雄进行协议合并
// PlayerInfoProto.AllGiftGoodsIndication.Builder build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo);
// SimpleTransaction.current().dealWhileCommit(new SimpleTransaction.SendTask(build.build(), MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE));
// }
// }
// }
//}

View File

@ -73,7 +73,7 @@ public class PlayerManager extends MongoBase {
private Set<Integer> reds = new CopyOnWriteArraySet<>();
private RechargeInfo rechargeInfo;
// private RechargeInfo rechargeInfo;
private NewRechargeInfo newRechargeInfo;
private Map<Integer,Integer> monthCard = new HashMap<>();//月卡信息
private Set<Integer> monthCardDailyTake = new HashSet<>();
@ -312,7 +312,7 @@ public class PlayerManager extends MongoBase {
public boolean checkFunctionIsAllowed(int privilageId){
if(privilageId == VipPrivilegeType.UNLOCK_TRIAL_BOMB_REWARD){
return rechargeInfo.checkOneGoodsIsOverTimeByPrivilege(privilageId);
return newRechargeInfo.checkOneGoodsIsOverTimeByPrivilege(privilageId);
}
return vipInfo.containsKey(privilageId);
}
@ -467,15 +467,15 @@ public class PlayerManager extends MongoBase {
removeString(getMongoKey() +".vipInfo."+privilageId);
}
public RechargeInfo getRechargeInfo() {
return rechargeInfo;
}
public void setRechargeInfo(RechargeInfo rechargeInfo) {
rechargeInfo.init(this.getRootId(), getMongoKey()+".rechargeInfo");
this.rechargeInfo = rechargeInfo;
updateString("rechargeInfo", rechargeInfo);
}
// public RechargeInfo getRechargeInfo() {
// return rechargeInfo;
// }
//
// public void setRechargeInfo(RechargeInfo rechargeInfo) {
// rechargeInfo.init(this.getRootId(), getMongoKey()+".rechargeInfo");
// this.rechargeInfo = rechargeInfo;
// updateString("rechargeInfo", rechargeInfo);
// }
public Set<Integer> getReds() {
return reds;
@ -850,9 +850,9 @@ public class PlayerManager extends MongoBase {
if(((int)(System.currentTimeMillis()/1000)-map.getValue())>24*60*60*config.getContiueDays()){
iterator.remove();
if(key== Global.MONTHCARDID){
rechargeInfo.setMonthSaveAmt(0);
newRechargeInfo.setMonthRr(0);
}else if(key ==Global.LMONTHCARDID){
rechargeInfo.setSmonthSaveAmt(0);
newRechargeInfo.setsMonthRr(0);
}
}
}

View File

@ -1,283 +1,273 @@
package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import config.SRechargeCommodityConfig;
import io.netty.util.internal.ConcurrentSet;
import org.springframework.data.annotation.Transient;
import java.util.*;
public class RechargeInfo extends MongoBase{
private double saveAmt;//累计充值
private int soulCrystalAmt;//累计充值购买魂晶
private double monthSaveAmt ; //月卡累计总额
private double smonthSaveAmt ; //豪华月卡累计总额
private int isFirst;
private long createTime;
private int isDayFirst;
@Transient
private volatile Set<Integer> cacheSendedIds = new ConcurrentSet<>();
private Map<Integer,Long> levelBagMap = new HashMap<>();//等级开启
private Map<Integer,Long> levelAndMoneyBagMap = new HashMap<>();//等级礼包开启
private Map<Integer,Long> refreshBagMap = new HashMap<>();
private Map<Integer,Integer> buyGoodsTimes = new HashMap<>();
private Map<Integer,Integer> goodseDurationMap = new HashMap<>();
private Map<Integer,Integer> goodseSendDailyMap = new HashMap<>();
//特殊类型控制触发开启的商品表 如五星妖灵师类型5
private Map<Integer,Long> typeBagMap = new HashMap<>();
//动态商品可买数量
private Map<Integer,Integer> dyGoodsCanBuyTimes = new HashMap<>();
@Transient
private Map<Integer,Long> cacheSendedTypes = new HashMap<>();
public RechargeInfo(){
}
public boolean addNewSendId(int id){
cacheSendedIds.remove(-id);
return cacheSendedIds.add(id);
}
public void clearCacheSendId(){
cacheSendedIds.clear();
}
public void setRefreshBagMap(Map<Integer, Long> refreshBagMap) {
this.refreshBagMap = refreshBagMap;
updateString("refreshBagMap", refreshBagMap);
}
//检测商品是否过期
public Set<Integer> checkIsGoodsTypeOverTime(){
int now = (int)(System.currentTimeMillis()/1000);
Set<Integer> removeGoodsType = new HashSet<>();
Iterator<Map.Entry<Integer, Integer>> iterator = goodseDurationMap.entrySet().iterator();
while (iterator.hasNext()){
Map.Entry<Integer, Integer> next = iterator.next();
Integer key = next.getKey();
Integer value = next.getValue();
if(now> value){
removeString(getMongoKey()+".goodseDurationMap." + key);
iterator.remove();
removeGoodsType.add(key);
if(goodseSendDailyMap.containsKey(key)){
removeString(getMongoKey()+".goodseSendDailyMap." + key);
goodseSendDailyMap.remove(key);
}
}
}
return removeGoodsType;
}
public boolean checkOneGoodsIsOverTimeByPrivilege(int privilageId){
for(Map.Entry<Integer,Integer> item: goodseDurationMap.entrySet()){
SRechargeCommodityConfig sRechargeCommodityConfig = SRechargeCommodityConfig.rechargeCommodityConfigMap.get(item.getKey());
int[] openPrivilege = sRechargeCommodityConfig.getOpenPrivilege();
for(int privilege : openPrivilege){
if(privilege == privilageId){
if(System.currentTimeMillis()/1000 <= item.getValue()){
return true;
}
break;
}
}
}
return false;
}
public void setSaveAmt(double saveAmt){
if(this.saveAmt == 0){
createTime = System.currentTimeMillis();
updateString("createTime",createTime);
}
updateString("saveAmt",saveAmt);
this.saveAmt = saveAmt;
}
public void setFirst(int first) {
updateString("isFirst",first);
isFirst = first;
}
public void setDailyFirst(int first) {
updateString("isDayFirst",first);
isDayFirst = first;
}
public void setCreateTime(long createTime) {
updateString("createTime",createTime);
this.createTime = createTime;
}
public void setLevelBagMap(Map<Integer, Long> levelBagMap) {
updateString("levelBagMap",levelBagMap);
this.levelBagMap = levelBagMap;
}
public void setBuyGoodsTimes(Map<Integer, Integer> buyGoodsTimes) {
updateString("buyGoodsTimes",buyGoodsTimes);
this.buyGoodsTimes = buyGoodsTimes;
}
public void updateBuyGoodsTimes(int goodsId,int times) {
updateString("buyGoodsTimes."+goodsId,times);
this.buyGoodsTimes.put(goodsId,times);
cacheSendedIds.remove(goodsId);
}
public void updateGoodsTypeDuration(int goodsId,int durTime) {
updateString("goodseDurationMap." + goodsId,durTime);
this.goodseDurationMap.put(goodsId,durTime);
}
public double getSaveAmt() {
return saveAmt;
}
public long getCreateTime() {
return createTime;
}
public Map<Integer, Long> getLevelBagMap() {
return levelBagMap;
}
public Map<Integer, Integer> getBuyGoodsTimes() {
return buyGoodsTimes;
}
public int getIsFirst() {
return isFirst;
}
public int getIsDayFirst() {
return isDayFirst;
}
public Map<Integer, Integer> getGoodsDurationMap() {
return goodseDurationMap;
}
public Map<Integer, Integer> getGoodseSendDailyMap() {
return goodseSendDailyMap;
}
public void updateGoodsSendTime(int goodsType,int sendTime) {
updateString("goodseSendDailyMap." + goodsType,sendTime);
this.goodseSendDailyMap.put(goodsType,sendTime);
}
// public int getSoulCrystalAmt() {
// return soulCrystalAmt;
//package com.ljsd.jieling.logic.dao;
//
//import com.ljsd.common.mogodb.MongoBase;
//import config.SRechargeCommodityConfig;
//import io.netty.util.internal.ConcurrentSet;
//import org.springframework.data.annotation.Transient;
//
//import java.util.*;
//
//public class RechargeInfo extends MongoBase{
//
// private double saveAmt;//累计充值
//
// private double monthSaveAmt ; //月卡累计总额
// private double smonthSaveAmt ; //豪华月卡累计总额
//
// private int isFirst;//是否首冲过
// private long createTime;//首冲时间
// private int isDayFirst;
//
//
// @Transient
// private volatile Set<Integer> cacheSendedIds = new ConcurrentSet<>();
// private Map<Integer,Long> levelBagMap = new HashMap<>();//等级开启
// private Map<Integer,Long> levelAndMoneyBagMap = new HashMap<>();//key:rCIdV:时间戳 (动态) 神装礼包,间隔折扣
//
// private Map<Integer,Long> refreshBagMap = new HashMap<>();//刷新购买次数时间戳
//
// private Map<Integer,Integer> buyGoodsTimes = new HashMap<>();
//
// private Map<Integer,Integer> goodseDurationMap = new HashMap<>();
//
// private Map<Integer,Integer> goodseSendDailyMap = new HashMap<>();
//
// //特殊类型控制触发开启的商品表 如五星妖灵师类型5
// private Map<Integer,Long> typeBagMap = new HashMap<>();
// //动态商品可买数量key:rCIdV:可购买次数(动态)
// private Map<Integer,Integer> dyGoodsCanBuyTimes = new HashMap<>();
//
// @Transient
// private Map<Integer,Long> cacheSendedTypes = new HashMap<>();
//
// public RechargeInfo(){
//
// }
//
// public void addSoulCrystalAmt(int soulCrystalAmt) {
// this.soulCrystalAmt += soulCrystalAmt;
// updateString("soulCrystalAmt",soulCrystalAmt);
// public boolean addNewSendId(int id){
// cacheSendedIds.remove(-id);
// return cacheSendedIds.add(id);
// }
public Map<Integer, Long> getTypeBagMap() {
return typeBagMap;
}
public void addTypeBagMap(Integer type, Long createTime) {
this.typeBagMap.put(type, createTime);
updateString("typeBagMap",typeBagMap);
}
public void removeTypeBagMap(Integer type) {
this.typeBagMap.remove(type);
updateString("typeBagMap",typeBagMap);
}
public Map<Integer, Long> getCacheSendedTypes() {
return cacheSendedTypes;
}
public void setCacheSendedTypes(Map<Integer, Long> cacheSendedTypes) {
this.cacheSendedTypes = cacheSendedTypes;
}
public Map<Integer, Integer> getDyGoodsCanBuyTimes() {
return dyGoodsCanBuyTimes;
}
public void addDyGoodsCanBuyTimes(Integer type) {
this.dyGoodsCanBuyTimes.put(type,this.dyGoodsCanBuyTimes.getOrDefault(type,0)+1 );
updateString("dyGoodsCanBuyTimes",dyGoodsCanBuyTimes);
}
public void putDyGoodsCanBuyTimes(Integer type,Integer value) {
this.dyGoodsCanBuyTimes.put(type,value );
cacheSendedIds.remove(type);
updateString("dyGoodsCanBuyTimes",dyGoodsCanBuyTimes);
}
public void removeDyGoodsCanBuyTimes(Integer type) {
this.dyGoodsCanBuyTimes.remove(type);
updateString("dyGoodsCanBuyTimes",dyGoodsCanBuyTimes);
}
public void setDyGoodsCanBuyTimes(Map<Integer, Integer> dyGoodsCanBuyTimes) {
updateString("dyGoodsCanBuyTimes",dyGoodsCanBuyTimes);
this.dyGoodsCanBuyTimes = dyGoodsCanBuyTimes;
}
public Map<Integer, Long> getRefreshBagMap() {
return refreshBagMap;
}
public void updateRefreshMapByKey(int key,Long time){
refreshBagMap.put(key,time);
updateString("refreshBagMap", refreshBagMap);
}
public double getMonthSaveAmt() {
return monthSaveAmt;
}
public void setMonthSaveAmt(double monthSaveAmt) {
this.monthSaveAmt = monthSaveAmt;
updateString("monthSaveAmt",monthSaveAmt);
}
public double getSmonthSaveAmt() {
return smonthSaveAmt;
}
public void setSmonthSaveAmt(double smonthSaveAmt) {
this.smonthSaveAmt = smonthSaveAmt;
updateString("smonthSaveAmt",smonthSaveAmt);
}
public Map<Integer, Long> getLevelAndMoneyBagMap() {
return levelAndMoneyBagMap;
}
public void putLevelAndMoneyBagMap(Integer type,Long value) {
this.levelAndMoneyBagMap.put(type,value );
cacheSendedIds.remove(type);
updateString("levelAndMoneyBagMap",levelAndMoneyBagMap);
}
public void removeLevelAndMoneyBagMap(Integer type) {
this.levelAndMoneyBagMap.remove(type);
cacheSendedIds.remove(type);
updateString("levelAndMoneyBagMap",levelAndMoneyBagMap);
}
}
//
// public void clearCacheSendId(){
// cacheSendedIds.clear();
// }
//
// public void setRefreshBagMap(Map<Integer, Long> refreshBagMap) {
// this.refreshBagMap = refreshBagMap;
// updateString("refreshBagMap", refreshBagMap);
// }
//
// //检测商品是否过期(vipFlush)
// public Set<Integer> checkIsGoodsTypeOverTime(){
// int now = (int)(System.currentTimeMillis()/1000);
// Set<Integer> removeGoodsType = new HashSet<>();
// Iterator<Map.Entry<Integer, Integer>> iterator = goodseDurationMap.entrySet().iterator();
// while (iterator.hasNext()){
// Map.Entry<Integer, Integer> next = iterator.next();
// Integer key = next.getKey();
// Integer value = next.getValue();
// if(now> value){
// removeString(getMongoKey()+".goodseDurationMap." + key);
// iterator.remove();
// removeGoodsType.add(key);
// if(goodseSendDailyMap.containsKey(key)){
// removeString(getMongoKey()+".goodseSendDailyMap." + key);
// goodseSendDailyMap.remove(key);
// }
// }
// }
// return removeGoodsType;
// }
//
// public boolean checkOneGoodsIsOverTimeByPrivilege(int privilageId){
// for(Map.Entry<Integer,Integer> item: goodseDurationMap.entrySet()){
// SRechargeCommodityConfig sRechargeCommodityConfig = SRechargeCommodityConfig.rechargeCommodityConfigMap.get(item.getKey());
// int[] openPrivilege = sRechargeCommodityConfig.getOpenPrivilege();
// for(int privilege : openPrivilege){
// if(privilege == privilageId){
// if(System.currentTimeMillis()/1000 <= item.getValue()){
// return true;
// }
// break;
// }
// }
// }
// return false;
// }
//
// public void setSaveAmt(double saveAmt){
// if(this.saveAmt == 0){
// createTime = System.currentTimeMillis();
// updateString("createTime",createTime);
// }
// updateString("saveAmt",saveAmt);
// this.saveAmt = saveAmt;
// }
//
//
// public void setFirst(int first) {
// updateString("isFirst",first);
// isFirst = first;
// }
//
// public void setDailyFirst(int first) {
// updateString("isDayFirst",first);
// isDayFirst = first;
// }
//
//
// public void setCreateTime(long createTime) {
// updateString("createTime",createTime);
// this.createTime = createTime;
// }
//
// public void setLevelBagMap(Map<Integer, Long> levelBagMap) {
// updateString("levelBagMap",levelBagMap);
// this.levelBagMap = levelBagMap;
// }
//
// public void setBuyGoodsTimes(Map<Integer, Integer> buyGoodsTimes) {
// updateString("buyGoodsTimes",buyGoodsTimes);
// this.buyGoodsTimes = buyGoodsTimes;
// }
//
// public void updateBuyGoodsTimes(int goodsId,int times) {
// updateString("buyGoodsTimes."+goodsId,times);
// this.buyGoodsTimes.put(goodsId,times);
// cacheSendedIds.remove(goodsId);
// }
//
// public void updateGoodsTypeDuration(int goodsId,int durTime) {
// updateString("goodseDurationMap." + goodsId,durTime);
// this.goodseDurationMap.put(goodsId,durTime);
// }
//
//
// public double getSaveAmt() {
// return saveAmt;
// }
//
// public long getCreateTime() {
// return createTime;
// }
//
// public Map<Integer, Long> getLevelBagMap() {
// return levelBagMap;
// }
//
// public Map<Integer, Integer> getBuyGoodsTimes() {
// return buyGoodsTimes;
// }
//
// public int getIsFirst() {
// return isFirst;
// }
//
// public int getIsDayFirst() {
// return isDayFirst;
// }
//
// public Map<Integer, Integer> getGoodsDurationMap() {
// return goodseDurationMap;
// }
//
// public Map<Integer, Integer> getGoodseSendDailyMap() {
// return goodseSendDailyMap;
// }
//
// public void updateGoodsSendTime(int goodsType,int sendTime) {
// updateString("goodseSendDailyMap." + goodsType,sendTime);
// this.goodseSendDailyMap.put(goodsType,sendTime);
// }
//
// public Map<Integer, Long> getTypeBagMap() {
// return typeBagMap;
// }
//
// public void addTypeBagMap(Integer type, Long createTime) {
// this.typeBagMap.put(type, createTime);
// updateString("typeBagMap",typeBagMap);
// }
// public void removeTypeBagMap(Integer type) {
// this.typeBagMap.remove(type);
// updateString("typeBagMap",typeBagMap);
// }
//
// public Map<Integer, Long> getCacheSendedTypes() {
// return cacheSendedTypes;
// }
//
// public void setCacheSendedTypes(Map<Integer, Long> cacheSendedTypes) {
// this.cacheSendedTypes = cacheSendedTypes;
// }
//
//
// public Map<Integer, Integer> getDyGoodsCanBuyTimes() {
// return dyGoodsCanBuyTimes;
// }
//
// public void addDyGoodsCanBuyTimes(Integer type) {
// this.dyGoodsCanBuyTimes.put(type,this.dyGoodsCanBuyTimes.getOrDefault(type,0)+1 );
// updateString("dyGoodsCanBuyTimes",dyGoodsCanBuyTimes);
// }
//
// public void putDyGoodsCanBuyTimes(Integer type,Integer value) {
// this.dyGoodsCanBuyTimes.put(type,value );
// cacheSendedIds.remove(type);
// updateString("dyGoodsCanBuyTimes",dyGoodsCanBuyTimes);
// }
// public void removeDyGoodsCanBuyTimes(Integer type) {
// this.dyGoodsCanBuyTimes.remove(type);
// updateString("dyGoodsCanBuyTimes",dyGoodsCanBuyTimes);
// }
// public void setDyGoodsCanBuyTimes(Map<Integer, Integer> dyGoodsCanBuyTimes) {
// updateString("dyGoodsCanBuyTimes",dyGoodsCanBuyTimes);
// this.dyGoodsCanBuyTimes = dyGoodsCanBuyTimes;
// }
//
// public Map<Integer, Long> getRefreshBagMap() {
// return refreshBagMap;
// }
//
// public void updateRefreshMapByKey(int key,Long time){
// refreshBagMap.put(key,time);
// updateString("refreshBagMap", refreshBagMap);
// }
//
// public double getMonthSaveAmt() {
// return monthSaveAmt;
// }
//
// public void setMonthSaveAmt(double monthSaveAmt) {
// this.monthSaveAmt = monthSaveAmt;
// updateString("monthSaveAmt",monthSaveAmt);
// }
//
// public double getSmonthSaveAmt() {
// return smonthSaveAmt;
// }
//
// public void setSmonthSaveAmt(double smonthSaveAmt) {
// this.smonthSaveAmt = smonthSaveAmt;
// updateString("smonthSaveAmt",smonthSaveAmt);
// }
//
// public Map<Integer, Long> getLevelAndMoneyBagMap() {
// return levelAndMoneyBagMap;
// }
//
// public void putLevelAndMoneyBagMap(Integer type,Long value) {
// this.levelAndMoneyBagMap.put(type,value );
// cacheSendedIds.remove(type);
// updateString("levelAndMoneyBagMap",levelAndMoneyBagMap);
// }
//
// public void removeLevelAndMoneyBagMap(Integer type) {
// this.levelAndMoneyBagMap.remove(type);
// cacheSendedIds.remove(type);
// updateString("levelAndMoneyBagMap",levelAndMoneyBagMap);
// }
//
//
//}

View File

@ -118,7 +118,6 @@ public class UserManager {
playerManager.setSendDays(1);
playerManager.updateVipInfo(GlobalsDef.LEVEL_UNLOCK_PRIVILEGE,1);
playerManager.updateVipInfo(GlobalsDef.VIP_UNLOCK_PRIVILEGE,0);
playerManager.setRechargeInfo(new RechargeInfo());
playerManager.setNewRechargeInfo(new NewRechargeInfo());
playerManager.setPhoneBindInfo(new PhoneBindInfo(""));
playerManager.setChannel(channel);

View File

@ -19,7 +19,7 @@ import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.util.ItemUtil;
@ -537,8 +537,7 @@ public class ExpeditionLogic {
if(TimeUtils.nowInt()>=createTime){
user.getExpeditionManager().resetTreasureReward();
sendAllTreasureInfo(user);
BuyGoodsLogic.sendGiftGooodsIndication(user.getId());
user.getPlayerInfoManager().getRechargeInfo().updateBuyGoodsTimes(sExpeditionSetting.getTreasureTime()[0][2],0);
BuyGoodsNewLogic.sendGiftGooodsIndication(user.getId());
}
}

View File

@ -1161,7 +1161,7 @@ public class GuildLogic {
}
AbstractRank rank = RankContext.getRankEnum(RankEnum.GUILD_RED_PACKAGE_RANK.getType());
double scoreById = rank.getScoreById(uid, String.valueOf(user.getPlayerInfoManager().getGuildId()));
double price = SRechargeCommodityConfig.rechargeCommodityConfigMap.get(config.getTradeId()).getPrice();
double price = SRechargeCommodityNewConfig.configMap.get(config.getTradeId()).getPrice();
if(scoreById==-1||scoreById==0){
price+=TimeUtils.getDoubleTime();
}else{

View File

@ -21,7 +21,6 @@ import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.logic.activity.ActivityType;
import com.ljsd.jieling.logic.activity.event.*;
import com.ljsd.jieling.logic.activity.eventhandler.HeroFiveStarGetEventHandler;
import com.ljsd.jieling.logic.activity.eventhandler.LeveGiftEventHander;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
@ -55,7 +54,6 @@ public class HeroLogic{
public HeroLogic(){
//英雄事件监听
Poster.getPoster().listenEvent(new HeroFiveStarGetEventHandler(), HeroFiveStarGetEvent.class);
Poster.getPoster().listenEvent(new LeveGiftEventHander(), UserLevelEvent.class);
}
public static List<Integer> transTemplate = new ArrayList<>();

View File

@ -1,13 +1,13 @@
package com.ljsd.jieling.logic.mission.event;
import com.ljsd.jieling.logic.dao.RechargeInfo;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.mission.GameMisionType;
import com.ljsd.jieling.logic.mission.MissionType;
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import config.SRechargeCommodityConfig;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.network.session.ISession;
import java.util.List;
import java.util.Map;
@ -21,21 +21,8 @@ public class UserLevelEventProcessor implements BaseGameEventProcessor{
}
int oldLevel = (int)parm[0];
int upLevel = (int)parm[1];
Map<Integer, SRechargeCommodityConfig> rechargeLevelMap = SRechargeCommodityConfig.rechargeLevelMap;
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
Map<Integer, Long> levelBagMap = rechargeInfo.getLevelBagMap();
boolean sendGiftGoods = false;
for (int level = oldLevel + 1; level <= upLevel; level++) {
if (rechargeLevelMap.containsKey(level)) {
if (!levelBagMap.containsKey(level)) {
levelBagMap.put(level, System.currentTimeMillis());
sendGiftGoods = true;
}
}
}
if (upLevel!=1 && sendGiftGoods) {
rechargeInfo.setLevelBagMap(levelBagMap);
BuyGoodsLogic.sendGiftGooodsIndication(user.getId());
}
ISession session = OnlineUserManager.getSessionByUid(user.getId());
BuyGoodsNewLogic.openPush(session,user,3,upLevel);
}
}

View File

@ -36,6 +36,7 @@ import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
import com.ljsd.jieling.logic.mission.main.ServenMissionIdsType;
import com.ljsd.jieling.logic.store.GiftGoodsType;
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.CommonProto;
import rpc.protocols.MessageTypeProto;
@ -311,9 +312,7 @@ public class PlayerLogic {
public void vipflushEveryDay(User user, PlayerInfoProto.FivePlayerUpdateIndication.Builder fBuilder) throws Exception {
PlayerManager playerInfoManager = user.getPlayerInfoManager();
Set<Integer> removeGoodsType = playerInfoManager.getRechargeInfo().checkIsGoodsTypeOverTime();
int uid = user.getId();
sendExpiredMail(uid,removeGoodsType,1);
Set<Integer> removePrivileges = new HashSet<>(2);
int vipLevel = user.getPlayerInfoManager().getVipLevel();
sendVipDailyOrLevlUpReward(user, vipLevel,BIReason.VIP_DAY_REWARD);
@ -352,7 +351,6 @@ public class PlayerLogic {
.addAllPrivilege(privilegeList);
}
sendExpiredMail(uid,removePrivileges,2);
}
@ -369,26 +367,6 @@ public class PlayerLogic {
return collect;
}
private void sendExpiredMail(int uid,Set<Integer> expiredIds ,int type) throws Exception {
String title="";
String content="";
int nowTime =TimeUtils.nowInt();
for(int id : expiredIds){
if(type == 1){
SRechargeCommodityConfig sRechargeCommodityConfig = SRechargeCommodityConfig.rechargeCommodityConfigMap.get(id);
title =SErrorCodeEerverConfig.getI18NMessage("recharge_"+sRechargeCommodityConfig.getType()+"_expire_title");
content = SErrorCodeEerverConfig.getI18NMessage("recharge_"+sRechargeCommodityConfig.getType()+"_expire_txt");
}else if(type == 2){
title =SErrorCodeEerverConfig.getI18NMessage("privilege_"+id+"_title");
content = SErrorCodeEerverConfig.getI18NMessage("privilege_"+id+"_txt");
}
if(StringUtil.isEmpty(title)){
continue;
}
MailLogic.getInstance().sendMail(uid,title,content,"",nowTime, Global.MAIL_EFFECTIVE_TIME);
}
}
public void sendVipDailyOrLevlUpReward(User user, int vipLevel,int reson) throws Exception {
int[][] dailyGifts = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getDailyGift();
for(int[] dailyGift : dailyGifts){
@ -511,88 +489,6 @@ public class PlayerLogic {
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
}
public void sendDayilyMail(User user,int goodsType) throws Exception {
int nowTime = (int)(System.currentTimeMillis()/1000);
int level = user.getPlayerInfoManager().getLevel();
Map<Integer, Integer> goodsTypeDurationMap = user.getPlayerInfoManager().getRechargeInfo().getGoodsDurationMap();
Map<Integer, Integer> goodseSendDailyMap = user.getPlayerInfoManager().getRechargeInfo().getGoodseSendDailyMap();
for(Map.Entry<Integer,Integer> goodsInfo:goodsTypeDurationMap.entrySet()){
SRechargeCommodityConfig sRechargeCommodityConfig = SRechargeCommodityConfig.rechargeCommodityConfigMap.get(goodsInfo.getKey());
int type = sRechargeCommodityConfig.getType();
if(goodsType!=-1 && type!=goodsType){
continue;
}
int days =1;
int time = nowTime;
int remainDays=sRechargeCommodityConfig.getContiueDays() -1;
if(goodsType == -1){
Integer lastSendTime = goodseSendDailyMap.get(type);
if(lastSendTime!=null){
if(nowTime>goodsInfo.getValue()){
time = goodsInfo.getValue();
}
days = TimeUtils.differentDays(lastSendTime * 1000L,time * 1000L);
if(days <= 0){
continue;
}
remainDays = TimeUtils.differentDays(nowTime * 1000L, goodsInfo.getValue()*1000L);
}else{
continue;
}
}
user.getPlayerInfoManager().getRechargeInfo().updateGoodsSendTime(type,time);
String mailReward="";
if(type == GiftGoodsType.WEEKCARD){
int[][] rewardTemplates = sRechargeCommodityConfig.getExtraReward()[0];
int[][] rewards = new int[rewardTemplates.length][];
for(int i=0;i<rewardTemplates.length;i++){
int[] rewardTemplate = rewardTemplates[i];
int typeReward = rewardTemplate[0];
rewards[i] = new int[2];
rewards[i][0] = rewardTemplate[1];
switch (typeReward){
case 0:
rewards[i][1] = rewardTemplate[2];
break;
case 1:
rewards[i][1] = rewardTemplate[2] *level;
break;
case 2:
rewards[i][1] = rewardTemplate[2] * user.getPlayerInfoManager().getVipLevel();
break;
default:{
rewards[i][1] = rewardTemplate[2];
break;
}
}
}
mailReward = ItemUtil.getMailReward(rewards);
}else if( type == GiftGoodsType.FOUND_ONE || type == GiftGoodsType.FOUND_TWO){
}else{
int theIndexByTarget = MathUtils.getTheIndexByTarget(sRechargeCommodityConfig.getPlayerLevel(), level);
int[][] extraReward = sRechargeCommodityConfig.getExtraReward()[theIndexByTarget];
mailReward = ItemUtil.getMailReward(extraReward);
}
String title = SErrorCodeEerverConfig.getI18NMessage("recharge_"+type+"_daily_title");
if(remainDays<0){
remainDays=0;
}
int sendTims = days;
while (sendTims-->0){
if( type == GiftGoodsType.FOUND_ONE || type == GiftGoodsType.FOUND_TWO){
mailReward = ItemUtil.getMailReward(SLuxuryFund.getByFoundIdAndDay(goodsInfo.getKey(),sRechargeCommodityConfig.getContiueDays()-remainDays).getreward());
LOGGER.info(":{}:",sRechargeCommodityConfig.getContiueDays()-remainDays - sendTims);
}
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("recharge_"+type+"_daily_txt",new Object[]{remainDays + sendTims},new int[]{0},"#");
MailLogic.getInstance().sendMail(user.getId(),title,content,mailReward,nowTime, Global.MAIL_EFFECTIVE_TIME);
}
}
}
private String getRewardOfDay(int goodsId,int days){
@ -1004,11 +900,11 @@ public class PlayerLogic {
public List<CommonProto.MonthCardInfo> getMonthCardInfo(User user) {
List<CommonProto.MonthCardInfo> cardInfos = new LinkedList<>();
PlayerManager playerInfoManager = user.getPlayerInfoManager();
RechargeInfo rechargeInfo = playerInfoManager.getRechargeInfo();
NewRechargeInfo rechargeInfo = playerInfoManager.getNewRechargeInfo();
STableManager.getConfig(SMonthcardConfig.class).forEach((integer, sMonthcardConfig) -> {
int time = playerInfoManager.getMonthCard().getOrDefault(integer,0);
int state = playerInfoManager.getMonthCardDailyTake().contains(integer)?1:0;
double saveAmt = integer==1?rechargeInfo.getMonthSaveAmt():rechargeInfo.getSmonthSaveAmt();
double saveAmt = integer==1?rechargeInfo.getMonthRr():rechargeInfo.getsMonthRr();
cardInfos.add(CommonProto.MonthCardInfo.newBuilder().setId(integer).setEndingTime(time).setState(state).setTotleAmt(saveAmt).build());
});
return cardInfos;

View File

@ -65,7 +65,14 @@ public class BuyGoodsNewLogic {
List<AbstractWelfareBag> pAddList = new ArrayList<>();
List<Integer> garbageList = new ArrayList<>();
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
if(info == null){
info = new NewRechargeInfo();
user.getPlayerInfoManager().setNewRechargeInfo(info);
}
for(Map.Entry<Integer,SRechargeCommodityNewConfig> entry : SRechargeCommodityNewConfig.configMap.entrySet()){
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();
@ -122,26 +129,29 @@ public class BuyGoodsNewLogic {
/**
*
*/
public void testGoods(ISession session, String goodsId) throws Exception {
public static void testBuyGoods(ISession session,String goodsId) throws Exception {
SRechargeCommodityNewConfig sRechargeCommodityConfig = SRechargeCommodityNewConfig.getConfigById(Integer.valueOf(goodsId));
int uid = session.getUid();
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(Integer.valueOf(goodsId));
if(config == null){
if(sRechargeCommodityConfig == null){
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
int price = -999;
String openId = "gm-test";
String orderId = "111111";
if(!GameApplication.serverProperties.isDebug()){
if(config.getPrice()!=0){
if(sRechargeCommodityConfig.getPrice()!=0){
throw new ErrorCodeException("In a formal setting");
}else{
price = 0;
openId = "free-openId";
orderId = "free-order";
}
price = 0;
orderId = "free-order";
openId = "free-openId";
}
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TEST_BUY_GIGT_GOODS_RESPONSE_VALUE,null,true);
sendGoods(uid, goodsId, openId, orderId,System.currentTimeMillis(), price);
Result result = sendGoods(uid, goodsId, openId, orderId,System.currentTimeMillis(), price);
List<Integer> itemList = new ArrayList<>();
for(int[] item:sRechargeCommodityConfig.getBaseReward()){
itemList.add(item[0]);
}
}
public static Result sendGoods(int uid, String sdkGoodsId, String openId, String orderId, long orderTime, int amount) throws Exception {
@ -168,6 +178,9 @@ public class BuyGoodsNewLogic {
double priceTemp =config.getPrice();
int cfgType = SSpecialConfig.getIntegerValue(SSpecialConfig.EXCHANGE_FORCE_TYPE);
double price = priceTemp==0?0: SExchangeRate.doubleIntegerHashMap.get(cfgType).get((int)priceTemp);
if(amount!=-999&&MathUtils.doubleEquals(amount,price*10000)){
LOGGER.error("金额不对the uid={},the goodId={}, amount={},real={}", uid, goodsId, amount,price);
}
User user = UserManager.getUser(uid);
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
@ -249,8 +262,8 @@ public class BuyGoodsNewLogic {
}
public static void sendGiftGooodsIndication(int uid) throws Exception {
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
boolean change = BuyGoodsNewLogic.getGoodsBagInfo(uid, goodsBagInfo);
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
boolean change = getGoodsBagInfo(uid, goodsBagInfo);
ISession session = OnlineUserManager.getSessionByUid(uid);
if(session!=null && change){
PlayerInfoProto.AllGiftGoodsIndication build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
@ -406,8 +419,8 @@ public class BuyGoodsNewLogic {
if(privilegeType == VipPrivilegeType.ADVENTURE_BASE_REWARD){
CombatLogic.getInstance().getNewAdventureReward(user,true,(int)(TimeUtils.now()/1000));
}
VipInfo vipInfo = user.getPlayerInfoManager().getVipInfo().get(privilege);
user.getPlayerInfoManager().addVipInfo(privilege);
VipInfo vipInfo = user.getPlayerInfoManager().getVipInfo().get(privilege);
indication.addInfos(CommonProto.Privilege.newBuilder().setId(privilege).setUsedTimes(vipInfo.getCount()).setEffectTime(vipInfo.getEffectTime()).build());
}
@ -420,17 +433,15 @@ public class BuyGoodsNewLogic {
garbageList.add(bag.getModId());
return false;
}
//判断刷新时间
if(bag.getRefreshTime() > System.currentTimeMillis()){
bag.setOpen(true);
bag.setStartTime(bag.getRefreshTime());
bag.refresh();
}
if(bag.isOpen()){
if(bag.getEndTime() == 0){
//永久类型只需查看刷新时间
if(bag.getDailyUpdate()>0 && bag.getLastBuyTime()>0 &&
System.currentTimeMillis() > bag.getLastBuyTime()+bag.getDailyUpdate()* TimeUtils.DAY){
bag.setBuyTimes(0);
}
}else{
if(System.currentTimeMillis() > bag.getEndTime()){
bagTimeUp(bag);
}
if(bag.getType() != 1 && System.currentTimeMillis() > bag.getEndTime()){
bagTimeUp(user,bag);
}
}else{
boolean open = true;
@ -467,7 +478,7 @@ public class BuyGoodsNewLogic {
}else if(config.getOtype() == 3){
bag = new ReceiveWelfareBag(user,config);
}else if(config.getOtype() == 4){
bag = new PushWelfareBag(config);
bag = new PushWelfareBag(user,config);
}
}catch(Exception e){
e.printStackTrace();
@ -478,22 +489,15 @@ public class BuyGoodsNewLogic {
/**
*
*/
public static void bagTimeUp(AbstractWelfareBag bag){
public static void bagTimeUp(User user,AbstractWelfareBag bag){
bag.setOpen((false));
if(bag.getType() == RechargeType.timeLimit.getType() && bag.getDailyUpdate()<1){
bag.setProhibited(true);
user.getPlayerInfoManager().getNewRechargeInfo().removeTimeLimit((TimeLimitWelfareBag)bag);
}
if(bag.getRefreshTime() > System.currentTimeMillis()){
bag.setStartTime(bag.getRefreshTime());
for(String[] I : bag.getCondition()){
if(I[0].equals("4")){
bag.setEndTime(bag.getStartTime()+Long.parseLong(I[2]));
break;
}
}
bag.setRefreshTime(bag.getStartTime() + bag.getDailyUpdate() * TimeUtils.DAY);
if(bag.getType() == RechargeType.push.getType()){
user.getPlayerInfoManager().getNewRechargeInfo().removePush((PushWelfareBag) bag);
}
bag.setBuyTimes(0);
}
/**
@ -581,4 +585,51 @@ public class BuyGoodsNewLogic {
}
}
}
public static void openPush(ISession session,User user,int type,int num) throws Exception{
List<SPackPushConfig> list = SPackPushConfig.findConfigByCon(type,num);
if(list == null){
return;
}
for(SPackPushConfig con : list){
int bagId = judgePushCondition(user,con);
if(bagId > 0){
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(bagId);
initUnitWF(user,config);
}
}
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
getGoodsBagInfo(user.getId(), goodsBagInfo);
PlayerInfoProto.AllGiftGoodsIndication goodsBuild = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, goodsBuild, true);
}
private static int judgePushCondition(User user,SPackPushConfig con){
int[] scope = con.getScopeId();
if(scope[0] == 1){//主线关卡
int mainLevel = user.getMainLevelManager().getFightId();
if(mainLevel < scope[1]){
return -1;
}
}else if(scope[0] == 2){//爬塔
int towerLevel = con.getConditionId()[1];
if(towerLevel < scope[1]){
return -1;
}
}else if(scope[0] == 3){//玩家等级
int level = user.getPlayerInfoManager().getLevel();
if(level < scope[1]){
return -1;
}
}
double rr = user.getPlayerInfoManager().getNewRechargeInfo().getRr();
int index = 0;
for(int i = 1;i<con.getPersonas().length;i++){
if(con.getPersonas()[i] > rr){
index = i-1;
break;
}
}
return con.getPacks()[index];
}
}

View File

@ -522,7 +522,7 @@ public class StoreLogic implements IEventHandler {
// user.getPlayerInfoManager().addVipInfo(privilege);
// VipInfo vipInfo = user.getPlayerInfoManager().getVipInfo().get(privilege);
// indication.addInfos(CommonProto.Privilege.newBuilder().setId(privilege).setUsedTimes(vipInfo.getCount()).setEffectTime(vipInfo.getEffectTime()).build());
BuyGoodsLogic.addNewPrivilege(user,privilege,indication);
BuyGoodsNewLogic.addNewPrivilege(user,privilege,indication);
}
ISession sessionByUid = OnlineUserManager.getSessionByUid(uid);
@ -559,7 +559,7 @@ public class StoreLogic implements IEventHandler {
int[] buyRule = sStoreConfig.getBuyRule();
if(buyRule!=null&&buyRule.length>0){
//充值金额购买条件判断
if(buyRule[0]==1&&playerInfoManager.getRechargeInfo().getSaveAmt()<buyRule[1]){
if(buyRule[0]==1&&playerInfoManager.getNewRechargeInfo().getRr()<buyRule[1]){
return "充值金额不足,无权购买";
}
}

View File

@ -5,6 +5,8 @@ import com.ljsd.jieling.logic.store.newRechargeInfo.bean.PushWelfareBag;
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.HashMap;
import java.util.List;
import java.util.Map;
@ -19,11 +21,33 @@ public class NewRechargeInfo {
private long firstTime;//首冲时间
private int isDayFirst;
private Map<Integer,PerpetualWelfareBag> perpetualMap;//永久礼包
private Map<Integer,TimeLimitWelfareBag> timeLimitMap;//限时刷新礼包
private Map<Integer,ReceiveWelfareBag> receiveMap;//限时刷新礼包
private Map<Integer,PushWelfareBag> pushMap;//推送礼包
private List<Integer> garbage;//废弃礼包
private Map<Integer,PerpetualWelfareBag> perpetualMap = new HashMap<>();//永久礼包
private Map<Integer,TimeLimitWelfareBag> timeLimitMap = new HashMap<>();//限时刷新礼包
private Map<Integer,ReceiveWelfareBag> receiveMap = new HashMap<>();//限时刷新礼包
private Map<Integer,PushWelfareBag> pushMap = new HashMap<>();//推送礼包
private List<Integer> garbage = new ArrayList<>();//废弃礼包
private long lostTime; //上次记录时间
private int mainLineLost; //记录主线失败次数
private int towerLost; //记录爬塔失败次数
public boolean checkOneGoodsIsOverTimeByPrivilege(int privilegeId){
for(PerpetualWelfareBag bag : perpetualMap.values()){
if(!bag.isOpen()){
continue;
}
for(int privilege : bag.getPrivilege()){
if(privilegeId == privilege){
if(bag.getBuyTimes() > 0){
return true;
}
break;
}
}
}
return false;
}
public double getRr() {
return rr;
@ -133,7 +157,35 @@ public class NewRechargeInfo {
pushMap.put(bag.getModId(),bag);
}
public void removePush(PushWelfareBag bag){
pushMap.remove(bag.getModId());
}
public void addGarbage(List<Integer> list){
garbage.addAll(list);
}
public int getMainLineLost() {
return mainLineLost;
}
public void setMainLineLost(int mainLineLost) {
this.mainLineLost = mainLineLost;
}
public void addMainLineLost() {
mainLineLost++;
}
public int getTowerLost() {
return towerLost;
}
public void setTowerLost(int towerLost) {
this.towerLost = towerLost;
}
public void addTowerLost() {
towerLost++;
}
}

View File

@ -6,6 +6,7 @@ import config.SRechargeCommodityNewConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.annotation.Transient;
import util.TimeUtils;
public abstract class AbstractWelfareBag implements WelfareBag{
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractWelfareBag.class);
@ -23,6 +24,8 @@ public abstract class AbstractWelfareBag implements WelfareBag{
private long lastBuyTime;
private int buyTimes;
private long refreshTime;
private int[] privilege;
private int timeType;
@Transient
private String[][] condition;
@ -30,9 +33,24 @@ public abstract class AbstractWelfareBag implements WelfareBag{
modId = config.getId();
type = config.getOtype();
limit = config.getLimit();
condition = config.getOnSaleRule();
timeType = config.getTime();
dailyUpdate = config.getDailyUpdate();
continueDays = config.getContiueDays();
privilege = config.getOpenPrivilege();
if(!config.getOnSaleRule().equals("")){
String[] s = config.getOnSaleRule().split("\\|");
condition = new String[s.length][3];
int i = 0;
for (String s0 : s) {
String[] s1 = s0.split("#");
condition[i][0] = s1[0];
condition[i][1] = s1[1];
if(s1.length > 2){
condition[i][2] = s1[2];
}
i++;
}
}
}
@Override
@ -45,7 +63,7 @@ public abstract class AbstractWelfareBag implements WelfareBag{
LOGGER.error("礼包:{}已被禁",modId);
return false;
}
if(buyTimes >=limit){
if(limit != 0 && buyTimes >=limit){
LOGGER.error("礼包:{}购买次数为:{}超过限制:{}",modId,buyTimes,limit);
return false;
}
@ -85,6 +103,29 @@ public abstract class AbstractWelfareBag implements WelfareBag{
return rewardStr;
}
/**
*
*/
public void refresh(){
if(getTimeType() == 7){//每周刷新
setStartTime(TimeUtils.getCurWeekdayStartTime(1,0));
setRefreshTime(TimeUtils.getCurWeekdayStartTime(1,0) + TimeUtils.WEEK);
}else if(getTimeType() == 8){//每月刷新
setStartTime(TimeUtils.getCurMonthStartTime(1));
setRefreshTime(TimeUtils.getMonthStartTime(1,1));
}else{
for(String[] I : getCondition()){
if(I[0].equals("4")){
setEndTime(getStartTime()+Long.parseLong(I[2]));
setRefreshTime(getStartTime() + getDailyUpdate() * TimeUtils.DAY);
break;
}
}
}
setBuyTimes(0);
setLastBuyTime(0);
}
public int getModId() { return modId; }
public void setModId(int modId) {
@ -140,4 +181,20 @@ public abstract class AbstractWelfareBag implements WelfareBag{
public long getLastBuyTime() { return lastBuyTime; }
public void setLastBuyTime(long lastBuyTime) { this.lastBuyTime = lastBuyTime; }
public int[] getPrivilege() {
return privilege;
}
public void setPrivilege(int[] privilege) {
this.privilege = privilege;
}
public int getTimeType() {
return timeType;
}
public void setTimeType(int timeType) {
this.timeType = timeType;
}
}

View File

@ -20,14 +20,17 @@ 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() == 7){//自然周
setStartTime(TimeUtils.getCurWeekdayStartTime(1,0));
}else if(config.getTime() == 8){//自然月
setStartTime(TimeUtils.getCurMonthStartTime(1));
}
setEndTime(0);
}
}
if(config.getTime() == 7){//自然周
setStartTime(TimeUtils.getCurWeekdayStartTime(1,0));
setRefreshTime(TimeUtils.getCurWeekdayStartTime(1,0) + TimeUtils.WEEK);
}else if(config.getTime() == 8){//自然月
setStartTime(TimeUtils.getCurMonthStartTime(1));
setRefreshTime(TimeUtils.getMonthStartTime(1,1));
}
}
}

View File

@ -1,13 +1,26 @@
package com.ljsd.jieling.logic.store.newRechargeInfo.bean;
import com.ljsd.jieling.logic.dao.root.User;
import config.SRechargeCommodityNewConfig;
import util.TimeUtils;
/**
*
*/
public class PushWelfareBag extends AbstractWelfareBag {
public PushWelfareBag(SRechargeCommodityNewConfig config){
public PushWelfareBag(User user, SRechargeCommodityNewConfig config){
super(config);
setStartTime(System.currentTimeMillis());
setEndTime(System.currentTimeMillis() + 2 * TimeUtils.HOUR);
setOpen(true);
user.getPlayerInfoManager().getNewRechargeInfo().addPush(this);
}
@Override
public boolean buy() {
setEndTime(System.currentTimeMillis());
setOpen(false);
return true;
}
}

View File

@ -75,4 +75,11 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
private boolean bought ;
public boolean isBought() {
return bought;
}
public void setBought(boolean bought) {
this.bought = bought;
}
}

View File

@ -23,12 +23,6 @@ public class TimeLimitWelfareBag extends AbstractWelfareBag {
}else if(config.getTime() == 3){//开服时间
setStartTime(GameApplication.serverConfig.getCacheOpenTime()+Long.parseLong(I[1]));
setEndTime(GameApplication.serverConfig.getCacheOpenTime()+Long.parseLong(I[2]));
}else if(config.getTime() == 7){//自然周
setStartTime(TimeUtils.getCurWeekdayStartTime(1,0));
setEndTime(TimeUtils.getCurWeekdayStartTime(1,0)+Long.parseLong(I[2]));
}else if(config.getTime() == 8){//自然月
setStartTime(TimeUtils.getCurMonthStartTime(1));
setEndTime(TimeUtils.getCurMonthStartTime(1)+Long.parseLong(I[2]));
}
}
}

View File

@ -35,7 +35,7 @@ import com.ljsd.jieling.logic.family.GuildLogic;
import com.ljsd.jieling.logic.fight.CombatLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.question.QuestionLogic;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.thread.ThreadManager;
@ -130,7 +130,7 @@ public class MinuteTask extends Thread {
LOGGER.error("Exception::=>{}",e.toString());
}
try {
BuyGoodsLogic.minuteCheckReharge();
BuyGoodsNewLogic.minuteCheckReharge();
RedisUtil.getInstence().set(RedisKey.ONLINE_NUM+RedisKey.Delimiter_colon+GameApplication.serverId, String.valueOf(OnlineUserManager.sessionMap.entrySet().size()));
DeathPathLogic.getInstance().statusCheck();
}catch (Exception e){

View File

@ -13,6 +13,7 @@ import com.ljsd.jieling.logic.dao.root.GuildInfo;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.CombatLogic;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
import config.SGuildLevelConfig;
import config.SMainLevelConfig;
import config.SMonsterConfig;
@ -28,7 +29,7 @@ public class CBean2Proto {
public static CommonProto.Player getPlayer(int uid, PlayerManager playerManager, int maxMapId, int mapId, MapManager mapManager) {
RechargeInfo rechargeInfo = playerManager.getRechargeInfo();
NewRechargeInfo rechargeInfo = playerManager.getNewRechargeInfo();
CommonProto.Player.Builder builder = CommonProto.Player
.newBuilder()
@ -44,9 +45,9 @@ public class CBean2Proto {
.setLastUpdateEnergyTime(mapManager.getLastUpdateEnergyTime())
.setServerTime((int) (System.currentTimeMillis() / 1000))
.setMaxForce(playerManager.getMaxForce())
.setRechargeTime((int) (rechargeInfo.getCreateTime() / 1000))
.setSaveAmt((rechargeInfo.getSaveAmt()))
.setIsFirstRecharge(rechargeInfo.getIsFirst())
.setRechargeTime((int) (rechargeInfo.getFirstTime() / 1000))
.setSaveAmt((rechargeInfo.getRr()))
.setIsFirstRecharge(rechargeInfo.getIsFirst()?1:0)
.setHeadFrame(playerManager.getHeadFrame())
.setDesignation(playerManager.getUserTitle())
.setRide(playerManager.getUserMount())

View File

@ -3,15 +3,15 @@ package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
@Table(name ="PackPush")
public class SPackPushConfig implements BaseConfig {
private int id;
private String desc;
private int[][] conditionId;
private int[] scopeId;
private int[] conditionId;
private int priority;
private int cDTime;
private int count;
@ -20,22 +20,45 @@ public class SPackPushConfig implements BaseConfig {
private int statistics;
public static Map<Integer,SPackPushConfig> configMap;
public static Map<Integer,Map<Integer,List<SPackPushConfig>>> conditionMap;
public void init() throws Exception {
Map<Integer, SPackPushConfig> config = STableManager.getConfig(SPackPushConfig.class);
Map<Integer,SPackPushConfig> tempConfigMap = new HashMap<>();
Map<Integer,Map<Integer,List<SPackPushConfig>>> tempConditionMap = new HashMap<>();
for(SPackPushConfig newConfig : config.values()){
tempConfigMap.put(newConfig.getId(),newConfig);
int[] conditionId = newConfig.getConditionId();
if(tempConditionMap.containsKey(conditionId[0])){
if(tempConditionMap.get(conditionId[0]).containsKey(conditionId[1])){
tempConditionMap.get(conditionId[0]).get(conditionId[1]).add(newConfig);
}else{
List<SPackPushConfig> list = new ArrayList<>();
list.add(newConfig);
tempConditionMap.get(conditionId[0]).put(conditionId[1],list);
}
}else{
Map<Integer,List<SPackPushConfig>> map = new HashMap<>();
List<SPackPushConfig> list = new ArrayList<>();
list.add(newConfig);
map.put(conditionId[1],list);
tempConditionMap.put(conditionId[0],map);
}
}
if(configMap == null){
configMap = tempConfigMap;
conditionMap = tempConditionMap;
}
}
public SPackPushConfig getConfigById(int id){
public static SPackPushConfig getConfigById(int id){
return configMap.get(id);
}
public static List<SPackPushConfig> findConfigByCon(int type,int num){
return conditionMap.get(type).get(num);
}
public int getId() {
return id;
}
@ -52,11 +75,19 @@ public class SPackPushConfig implements BaseConfig {
this.desc = desc;
}
public int[][] getConditionId() {
public int[] getScopeId() {
return scopeId;
}
public void setScopeId(int[] scopeId) {
this.scopeId = scopeId;
}
public int[] getConditionId() {
return conditionId;
}
public void setConditionId(int[][] conditionId) {
public void setConditionId(int[] conditionId) {
this.conditionId = conditionId;
}

View File

@ -35,7 +35,7 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
private int time;
private String[][] onSaleRule;
private String onSaleRule;
private int dailyUpdate;
@ -45,20 +45,18 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
private String rechargeId3;
// public static Map<Integer,SRechargeCommodityNewConfig> perpetualMap;//永久礼包
// public static Map<Integer,SRechargeCommodityNewConfig> timeLimitMap;//限时刷新礼包
// public static Map<Integer,SRechargeCommodityNewConfig> receiveMap;//限时刷新礼包
// public static Map<Integer,SRechargeCommodityNewConfig> pushMap;//推送礼包
private String rechargeId4;
private String rechargeId5;
private String rechargeId6;
public static Map<Integer,SRechargeCommodityNewConfig> configMap;
public static Map<String,SRechargeCommodityNewConfig> sdkconfigMap;
public void init() throws Exception {
Map<Integer, SRechargeCommodityNewConfig> config = STableManager.getConfig(SRechargeCommodityNewConfig.class);
// Map<Integer,SRechargeCommodityNewConfig> tempPerpetualMap = new HashMap<>();//永久礼包
// Map<Integer,SRechargeCommodityNewConfig> tempTimeLimitMap = new HashMap<>();//限时刷新礼包
// Map<Integer,SRechargeCommodityNewConfig> tempReceiveMap = new HashMap<>();//限时刷新礼包
// Map<Integer,SRechargeCommodityNewConfig> tempPushMap = new HashMap<>();//推送礼包
Map<Integer,SRechargeCommodityNewConfig> tempConfigMap = new HashMap<>();
Map<String,SRechargeCommodityNewConfig> tempSdkConfigMap = new HashMap<>();
for(SRechargeCommodityNewConfig newConfig : config.values()){
@ -66,20 +64,7 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
tempSdkConfigMap.put(newConfig.getRechargeId(),newConfig);
tempSdkConfigMap.put(newConfig.getRechargeId2(),newConfig);
tempSdkConfigMap.put(newConfig.getRechargeId3(),newConfig);
// if(newConfig.getOtype() == 1){
// tempPerpetualMap.put(newConfig.getId(),newConfig);
// }else if(newConfig.getOtype() == 2){
// tempTimeLimitMap.put(newConfig.getId(),newConfig);
// }else if(newConfig.getOtype() == 3){
// tempReceiveMap.put(newConfig.getId(),newConfig);
// }else if(newConfig.getOtype() == 4){
// tempPushMap.put(newConfig.getId(),newConfig);
// }
}
// perpetualMap = tempPerpetualMap;
// timeLimitMap = tempTimeLimitMap;
// receiveMap = tempReceiveMap;
// pushMap = tempPushMap;
if(configMap == null){
configMap = tempConfigMap;
sdkconfigMap = tempSdkConfigMap;
@ -118,7 +103,7 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
public int getTime() { return time; }
public String[][] getOnSaleRule() { return onSaleRule; }
public String getOnSaleRule() { return onSaleRule; }
public int getDailyUpdate() { return dailyUpdate; }
@ -128,5 +113,15 @@ public class SRechargeCommodityNewConfig implements BaseConfig {
public String getRechargeId3() { return rechargeId3; }
public String getRechargeId4() {
return rechargeId4;
}
public String getRechargeId5() {
return rechargeId5;
}
public String getRechargeId6() {
return rechargeId6;
}
}