周卡月卡调整,兼容老版本

duhui 2022-06-17 12:31:54 +08:00
parent be1ea53244
commit b0f6149358
3 changed files with 27 additions and 8 deletions

View File

@ -76,6 +76,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
User user = UserManager.getUser(userId); User user = UserManager.getUser(userId);
QuestionLogic.getInstence().onLogin(user); QuestionLogic.getInstence().onLogin(user);
PlayerManager playerInfoManager = user.getPlayerInfoManager(); PlayerManager playerInfoManager = user.getPlayerInfoManager();
PlayerLogic.getInstance().checkOldMonthCard(user);
ActivityLogic.getInstance().flushForLogin(user,iSession); ActivityLogic.getInstance().flushForLogin(user,iSession);
GlobalDataManaager.checkNeedReFlush(iSession,user,null); GlobalDataManaager.checkNeedReFlush(iSession,user,null);
BuyGoodsNewLogic.refreshWelfareState(user); BuyGoodsNewLogic.refreshWelfareState(user);

View File

@ -1001,7 +1001,7 @@ public class PlayerManager extends MongoBase {
iterator.remove(); iterator.remove();
continue; continue;
} }
int beginOfDay = (int)(TimeUtils.getBeginOfDay(map.getValue() * 1000))/1000; int beginOfDay= map.getValue();
// 结束时间 // 结束时间
int lastTime = beginOfDay + 24*60*60*config.getContiueDays(); int lastTime = beginOfDay + 24*60*60*config.getContiueDays();
if(nowInt>=lastTime){ if(nowInt>=lastTime){
@ -1012,6 +1012,11 @@ public class PlayerManager extends MongoBase {
return monthCard; return monthCard;
} }
public void setMonthCard(Map<Integer,Integer> map){
this.monthCard = map;
updateString("monthCard",monthCard);
}
public void putMonthCard(Integer id, Integer time) { public void putMonthCard(Integer id, Integer time) {
monthCard.put(id, time); monthCard.put(id, time);
updateString("monthCard",monthCard); updateString("monthCard",monthCard);

View File

@ -52,6 +52,7 @@ import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.thrift.idl.*; import com.ljsd.jieling.thrift.idl.*;
import com.ljsd.jieling.thrift.pool.ClientAdapterPo; import com.ljsd.jieling.thrift.pool.ClientAdapterPo;
import com.ljsd.jieling.util.*; import com.ljsd.jieling.util.*;
import com.mongodb.Mongo;
import config.*; import config.*;
import manager.STableManager; import manager.STableManager;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -1682,13 +1683,9 @@ public class PlayerLogic {
int state = 0; int state = 0;
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(monthcardConfig.getPrice()); SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(monthcardConfig.getPrice());
if (config != null){ RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(config.getOtype());
RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(config.getOtype()); AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(config.getId());
AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(config.getId()); if (bag != null && !bag.checkBuy()){
if (bag != null && !bag.checkBuy()){
state = playerInfoManager.getMonthCardDailyTake().contains(monthcardConfig.getId())?2:1;
}
}else {
state = playerInfoManager.getMonthCardDailyTake().contains(monthcardConfig.getId())?2:1; state = playerInfoManager.getMonthCardDailyTake().contains(monthcardConfig.getId())?2:1;
} }
@ -1697,6 +1694,22 @@ public class PlayerLogic {
return cardInfos; return cardInfos;
} }
public void checkOldMonthCard(User user){
Map<Integer, Integer> monthCard = user.getPlayerInfoManager().getMonthCard();
HashMap<Integer, Integer> map = new HashMap<>();
Integer oldone = monthCard.get(1);
if (oldone!=null){
int begin = (int)(TimeUtils.getBeginOfDay(oldone * 1000)/1000);
map.put(2,begin);
}
Integer oldtwo = monthCard.get(2);
if (oldtwo!=null){
int begin = (int)(TimeUtils.getBeginOfDay(oldtwo * 1000)/1000);
map.put(3,begin);
}
user.getPlayerInfoManager().setMonthCard(map);
}
/** /**
* *
* @param user * @param user