周卡月卡调整,改时间bug,三版
parent
cd3dba3982
commit
92a63c75e3
|
@ -1,13 +1,12 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import config.SCampTowerSetting;
|
||||
import config.SMonthcardConfig;
|
||||
import config.SPrivilegeTypeConfig;
|
||||
|
@ -991,19 +990,20 @@ public class PlayerManager extends MongoBase {
|
|||
}
|
||||
|
||||
public Map<Integer, Integer> getMonthCard() {
|
||||
// 当天时间
|
||||
int nowInt = TimeUtils.nowInt();
|
||||
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator = monthCard.entrySet().iterator();
|
||||
while (iterator.hasNext()){
|
||||
Map.Entry<Integer,Integer> map = iterator.next();
|
||||
Integer key = map.getKey();
|
||||
SMonthcardConfig config = STableManager.getConfig(SMonthcardConfig.class).get(key);
|
||||
SMonthcardConfig config = STableManager.getConfig(SMonthcardConfig.class).get(map.getKey());
|
||||
if(null==config){
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
int residueTime = nowInt-map.getValue();
|
||||
int lastTime = 24*60*60*config.getContiueDays();
|
||||
if(residueTime>=lastTime){
|
||||
// 结束时间
|
||||
int lastTime = map.getValue() + 24*60*60*config.getContiueDays();
|
||||
if(nowInt>=lastTime){
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1674,15 +1674,21 @@ public class PlayerLogic {
|
|||
|
||||
Map<Integer, SMonthcardConfig> monthcardConfigMap = STableManager.getConfig(SMonthcardConfig.class);
|
||||
for (SMonthcardConfig monthcardConfig : monthcardConfigMap.values()) {
|
||||
int time = playerInfoManager.getMonthCard().getOrDefault(monthcardConfig.getId(),0);
|
||||
int state = 0;
|
||||
int startTime = playerInfoManager.getMonthCard().getOrDefault(monthcardConfig.getId(),0);
|
||||
int endTime = 0;
|
||||
if (startTime != 0){
|
||||
endTime = startTime + monthcardConfig.getContiueDays() * 24 * 60 * 60;
|
||||
}
|
||||
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(monthcardConfig.getPrice());
|
||||
RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(config.getOtype());
|
||||
AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(config.getId());
|
||||
|
||||
int state = 0;
|
||||
if (bag != null && !bag.checkBuy()){
|
||||
state = playerInfoManager.getMonthCardDailyTake().contains(monthcardConfig.getId())?2:1;
|
||||
}
|
||||
cardInfos.add(CommonProto.MonthCardInfo.newBuilder().setId(monthcardConfig.getId()).setEndingTime(time).setState(state).setTotleAmt(0).build());
|
||||
cardInfos.add(CommonProto.MonthCardInfo.newBuilder().setId(monthcardConfig.getId()).setEndingTime(endTime).setState(state).setTotleAmt(0).build());
|
||||
}
|
||||
return cardInfos;
|
||||
}
|
||||
|
|
|
@ -508,7 +508,9 @@ public class BuyGoodsNewLogic {
|
|||
for (SMonthcardConfig monthcardConfig : monthcardConfigMap.values()) {
|
||||
if (goodId == monthcardConfig.getPrice()){
|
||||
sendneed=true;
|
||||
user.getPlayerInfoManager().putMonthCard(monthcardConfig.getId(), TimeUtils.nowInt());
|
||||
// 当天零点
|
||||
int beginOfDay = (int) (TimeUtils.getBeginOfDay(TimeUtils.now())/1000);
|
||||
user.getPlayerInfoManager().putMonthCard(monthcardConfig.getId(), beginOfDay);
|
||||
// 特殊处理
|
||||
if (monthcardConfig.getId() == Global.LMONTHCARDID){
|
||||
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.RECHARGE_BUY.getType(),Global.LMONTHCARDID));
|
||||
|
|
Loading…
Reference in New Issue