Merge branch 'master_test_gn' into master_prb_gn
commit
1db35a294f
|
|
@ -304,6 +304,12 @@ public class TimeUtils {
|
|||
return format1.parse(time);
|
||||
}
|
||||
|
||||
public static long dateFormat2(String time) throws ParseException {
|
||||
DateFormat format1 = new SimpleDateFormat(ymdhms_Format_new);
|
||||
return format1.parse(time).getTime();
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 是否是同一天
|
||||
// *
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ public interface GlobalsDef {
|
|||
int VIP_UNLOCK_PRIVILEGE = 3;
|
||||
int RECHARGE_UNLOCK_PRIVILEGE = 4;
|
||||
int LIKABLE_UNLOCK=6;//好感度解锁类型
|
||||
int WEEKCARD_UNLOCK=8;//周卡解锁类型
|
||||
|
||||
//特殊商店id
|
||||
int DAILY_GOODS_FAST_ID = 1004;//每日礼包一键购买的礼包ID
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
User user = UserManager.getUser(userId);
|
||||
QuestionLogic.getInstence().onLogin(user);
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
PlayerLogic.getInstance().checkOldMonthCard(user);
|
||||
ActivityLogic.getInstance().flushForLogin(user,iSession);
|
||||
GlobalDataManaager.checkNeedReFlush(iSession,user,null);
|
||||
BuyGoodsNewLogic.refreshWelfareState(user);
|
||||
|
|
@ -251,16 +252,16 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
// 心愿抽卡 旧玩家兼容
|
||||
wishOldUserRandomNumInit(user);
|
||||
//hotfix 月卡
|
||||
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(newRechargeInfo.getMonthRr()>=monthline&&playerInfoManager.getMonthCard().getOrDefault(1,0)==0){
|
||||
user.getPlayerInfoManager().getMonthCard().put(Global.MONTHCARDID, (int) (System.currentTimeMillis() / 1000));
|
||||
}
|
||||
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));
|
||||
}
|
||||
// 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(newRechargeInfo.getMonthRr()>=monthline&&playerInfoManager.getMonthCard().getOrDefault(1,0)==0){
|
||||
// user.getPlayerInfoManager().getMonthCard().put(Global.MONTHCARDID, (int) (System.currentTimeMillis() / 1000));
|
||||
// }
|
||||
// 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));
|
||||
// }
|
||||
|
||||
// 四灵试炼初始化
|
||||
FourChallengeLogic.getInstance().firstGetTimes(user);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ public class MonthTakeDailyHandler extends BaseHandler <PlayerInfoProto.TakeMoth
|
|||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
|
||||
|
||||
if(!user.getPlayerInfoManager().getMonthCard().containsKey(proto.getType())){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("未激活"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -84,6 +83,8 @@ public class PlayerManager extends MongoBase {
|
|||
private RechargeInfo rechargeInfo;
|
||||
private NewRechargeInfo newRechargeInfo;
|
||||
private Map<Integer,Integer> monthCard = new HashMap<>();//月卡信息
|
||||
|
||||
private int oldMonthCardMark;//旧月卡处理标识
|
||||
private Set<Integer> monthCardDailyTake = new HashSet<>();
|
||||
|
||||
private int headFrame;
|
||||
|
|
@ -558,7 +559,7 @@ public class PlayerManager extends MongoBase {
|
|||
VipInfo newVipInfo = new VipInfo();
|
||||
if(config.getContinueTime()!=null&&config.getContinueTime().length>0){
|
||||
if(vipInfo.containsKey(privilageId)){
|
||||
if(config.getContinueTime()[1]==1&&TimeUtils.now()/1000<vipInfo.get(privilageId).getEffectTime()){
|
||||
if(config.getContinueTime()[1]==1&&TimeUtils.nowInt()<vipInfo.get(privilageId).getEffectTime()){
|
||||
if(config.getCondition().length==1&&config.getCondition()[0][0]==0){
|
||||
return;
|
||||
}else{
|
||||
|
|
@ -991,37 +992,45 @@ 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;
|
||||
}
|
||||
if(((int)(System.currentTimeMillis()/1000)-map.getValue())>24*60*60*config.getContiueDays()){
|
||||
int beginOfDay= map.getValue();
|
||||
// 结束时间
|
||||
int lastTime = beginOfDay + 24*60*60*config.getContiueDays();
|
||||
if(nowInt>=lastTime){
|
||||
iterator.remove();
|
||||
if(key== Global.MONTHCARDID){
|
||||
newRechargeInfo.setMonthRr(0);
|
||||
}else if(key ==Global.LMONTHCARDID){
|
||||
newRechargeInfo.setsMonthRr(0);
|
||||
}else if(key ==Global.SINCERECARDID){
|
||||
newRechargeInfo.setSinceremonth(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
updateString("monthCard",monthCard);
|
||||
return monthCard;
|
||||
}
|
||||
|
||||
public void setMonthCard(Map<Integer, Integer> monthCard) {
|
||||
public void setMonthCard(Map<Integer,Integer> map){
|
||||
this.monthCard = map;
|
||||
updateString("monthCard",monthCard);
|
||||
this.monthCard = monthCard;
|
||||
}
|
||||
|
||||
public void putMonthCard(Integer id, Integer time) {
|
||||
this.monthCard.put(id, time);
|
||||
updateString("monthCard",this.monthCard);
|
||||
monthCard.put(id, time);
|
||||
updateString("monthCard",monthCard);
|
||||
}
|
||||
|
||||
public void setOldMonthCardMark(int mark){
|
||||
this.oldMonthCardMark = mark;
|
||||
updateString("oldMonthCardMark",oldMonthCardMark);
|
||||
}
|
||||
|
||||
public int getOldMonthCardMark(){
|
||||
return oldMonthCardMark;
|
||||
}
|
||||
|
||||
public Set<Integer> getMonthCardDailyTake() {
|
||||
|
|
|
|||
|
|
@ -44,11 +44,16 @@ import com.ljsd.jieling.logic.mission.MissionState;
|
|||
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.BuyGoodsNewLogic;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.RechargeHandler;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.thrift.idl.*;
|
||||
import com.ljsd.jieling.thrift.pool.ClientAdapterPo;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import com.mongodb.Mongo;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -59,9 +64,12 @@ import rpc.protocols.PlayerInfoProto;
|
|||
import util.MathUtils;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ljsd.jieling.logic.store.BuyGoodsNewLogic.refreshUnitWF;
|
||||
|
||||
public class PlayerLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PlayerLogic.class);
|
||||
private PlayerLogic(){
|
||||
|
|
@ -1526,7 +1534,7 @@ public class PlayerLogic {
|
|||
if(mCount==-1){
|
||||
return true;
|
||||
}
|
||||
if((info.getCount()+checkNum>mCount)|| (info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime())){
|
||||
if((info.getCount()+checkNum>mCount)|| (info.getEffectTime()!=0&&TimeUtils.nowInt()>info.getEffectTime())){
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -1608,7 +1616,7 @@ public class PlayerLogic {
|
|||
private int getMaxCountByPrivilege(User user,int privilegeId){
|
||||
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilegeId);
|
||||
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType());
|
||||
int mCount = 0;
|
||||
int mCount;
|
||||
int cond = 0;
|
||||
switch (sPrivilegeTypeConfig.getUnlockType()){
|
||||
case GlobalsDef.LEVEL_UNLOCK_PRIVILEGE:
|
||||
|
|
@ -1623,16 +1631,26 @@ public class PlayerLogic {
|
|||
case GlobalsDef.LIKABLE_UNLOCK:
|
||||
cond = user.getHeroManager().GetAllLikableLv();
|
||||
break;
|
||||
case GlobalsDef.WEEKCARD_UNLOCK:
|
||||
cond = user.getPlayerInfoManager().getMonthCard().getOrDefault(1, -1);
|
||||
break;
|
||||
default:{
|
||||
break;
|
||||
}
|
||||
}
|
||||
TreeMap<Integer, Integer> condition = (TreeMap)conditionMap.get(privilegeId);
|
||||
if(sPrivilegeTypeConfig.getUnlockType()!=GlobalsDef.RECHARGE_UNLOCK_PRIVILEGE){
|
||||
mCount = condition.floorEntry(cond).getValue();
|
||||
}else{
|
||||
if(sPrivilegeTypeConfig.getUnlockType()==GlobalsDef.RECHARGE_UNLOCK_PRIVILEGE){
|
||||
mCount = condition.get(0);
|
||||
}
|
||||
else if(sPrivilegeTypeConfig.getUnlockType()==GlobalsDef.WEEKCARD_UNLOCK){
|
||||
if (cond == -1){
|
||||
mCount = 0;
|
||||
}else {
|
||||
mCount = condition.get(0);
|
||||
}
|
||||
}else {
|
||||
mCount = condition.floorEntry(cond).getValue();
|
||||
}
|
||||
return mCount;
|
||||
}
|
||||
public int getMaxCountByPrivilegeType(User user ,int privilegeType){
|
||||
|
|
@ -1658,28 +1676,64 @@ public class PlayerLogic {
|
|||
public List<CommonProto.MonthCardInfo> getMonthCardInfo(User user) {
|
||||
List<CommonProto.MonthCardInfo> cardInfos = new LinkedList<>();
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
NewRechargeInfo rechargeInfo = playerInfoManager.getNewRechargeInfo();
|
||||
STableManager.getConfig(SMonthcardConfig.class).forEach((key, config) -> {
|
||||
int time = playerInfoManager.getMonthCard().getOrDefault(key,0);
|
||||
int state = playerInfoManager.getMonthCardDailyTake().contains(key)?1:0;
|
||||
double saveAmt = 0;
|
||||
switch (key){
|
||||
case 1:
|
||||
saveAmt = rechargeInfo.getMonthRr();
|
||||
break;
|
||||
case 2:
|
||||
saveAmt = rechargeInfo.getsMonthRr();
|
||||
break;
|
||||
case 3:
|
||||
saveAmt = rechargeInfo.getSinceremonth();
|
||||
break;
|
||||
default:break;
|
||||
|
||||
Map<Integer, SMonthcardConfig> monthcardConfigMap = STableManager.getConfig(SMonthcardConfig.class);
|
||||
for (SMonthcardConfig monthcardConfig : monthcardConfigMap.values()) {
|
||||
int startTime = playerInfoManager.getMonthCard().getOrDefault(monthcardConfig.getId(),0);
|
||||
int endTime = 0;
|
||||
if (startTime != 0){
|
||||
endTime = startTime + monthcardConfig.getContiueDays() * 24 * 60 * 60;
|
||||
}
|
||||
cardInfos.add(CommonProto.MonthCardInfo.newBuilder().setId(key).setEndingTime(time).setState(state).setTotleAmt(saveAmt).build());
|
||||
});
|
||||
|
||||
int state = 0;
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(monthcardConfig.getPrice());
|
||||
RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(config.getOtype());
|
||||
ReceiveWelfareBag bag = (ReceiveWelfareBag)rechargeHandler.getRechargeMap(user).get(config.getId());
|
||||
if (bag != null && bag.isBought()){
|
||||
state = playerInfoManager.getMonthCardDailyTake().contains(monthcardConfig.getId())?2:1;
|
||||
}
|
||||
|
||||
cardInfos.add(CommonProto.MonthCardInfo.newBuilder().setId(monthcardConfig.getId()).setEndingTime(endTime).setState(state).setTotleAmt(0).build());
|
||||
}
|
||||
return cardInfos;
|
||||
}
|
||||
|
||||
public void checkOldMonthCard(User user) throws Exception {
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
if (playerInfoManager.getOldMonthCardMark() == 1){
|
||||
return;
|
||||
}
|
||||
|
||||
double rmb = playerInfoManager.getNewRechargeInfo().getRr();
|
||||
|
||||
long createTime = playerInfoManager.getCreateTime();
|
||||
long format2 = TimeUtils.dateFormat2("2022-06-13 00:00:00");
|
||||
|
||||
playerInfoManager.setMonthCard(new HashMap<>());
|
||||
if (createTime < format2 && rmb >= 100){
|
||||
Map<Integer, SMonthcardConfig> configMap = STableManager.getConfig(SMonthcardConfig.class);
|
||||
for (SMonthcardConfig config : configMap.values()) {
|
||||
int goodId = config.getPrice();
|
||||
SRechargeCommodityNewConfig newConfig = SRechargeCommodityNewConfig.getConfigById(goodId);
|
||||
RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(newConfig.getOtype());
|
||||
AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(goodId);
|
||||
if (bag == null){
|
||||
bag = rechargeHandler.initUnitWF(user, newConfig);
|
||||
refreshUnitWF(bag,user);
|
||||
rechargeHandler.addNew(user,bag);
|
||||
}
|
||||
boolean bol = bag.buy();
|
||||
if (!bol){
|
||||
LOGGER.error("老玩家月卡兼容报错,礼包已购买,uid:{},goodid:{}",user.getId(),goodId);
|
||||
continue;
|
||||
}
|
||||
BuyGoodsNewLogic.activePrivilege(user,newConfig);
|
||||
BuyGoodsNewLogic.activeMonthCard(user,goodId);
|
||||
}
|
||||
}
|
||||
playerInfoManager.setOldMonthCardMark(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 限时头像框,旧内容兼容,一个玩家只运行一次
|
||||
* @param user
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package com.ljsd.jieling.logic.store;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.reportData.DataMessageUtils;
|
||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||
|
|
@ -14,9 +12,6 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||
import com.ljsd.jieling.ktbeans.ReportBaseBean;
|
||||
import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.logic.GlobalDataManaager;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
|
|
@ -24,7 +19,6 @@ import com.ljsd.jieling.logic.activity.AbstractActivity;
|
|||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.ActivityType;
|
||||
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
||||
import com.ljsd.jieling.logic.activity.activityLogic.WeekCardLogic;
|
||||
import com.ljsd.jieling.logic.activity.event.*;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.RechargeInfo;
|
||||
|
|
@ -45,7 +39,6 @@ import com.ljsd.jieling.network.server.ProtocolsManager;
|
|||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.thrift.idl.Result;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import com.ljsd.jieling.util.http.HttpPool;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -235,8 +228,8 @@ public class BuyGoodsNewLogic {
|
|||
info.setRr(MathUtils.doubleAdd(price,info.getRr()));
|
||||
info.setRechargeList(TimeUtils.now(),price);
|
||||
//处理月卡
|
||||
user.getPlayerInfoManager().getMonthCard();
|
||||
activeMonthCard(user,price,info);
|
||||
// user.getPlayerInfoManager().getMonthCard();
|
||||
activeMonthCard(user,config.getId());
|
||||
//活动
|
||||
user.getPlayerInfoManager().setRechargedaily(user.getPlayerInfoManager().getRechargedaily()+price);
|
||||
changeActivity(user,price,info);
|
||||
|
|
@ -484,33 +477,42 @@ public class BuyGoodsNewLogic {
|
|||
|
||||
/**
|
||||
* 激活月卡 //TODO 孟某某写的啥玩意 咋兼容老数据 后人注意这块 新加的月卡 策划大大讨论后从0开始计算
|
||||
* 2022-6-6 月卡重做
|
||||
*/
|
||||
public static void activeMonthCard(User user,double price,NewRechargeInfo info){
|
||||
int monthline = STableManager.getConfig(SMonthcardConfig.class).get(Global.MONTHCARDID).getPrice();
|
||||
int lmonthline = STableManager.getConfig(SMonthcardConfig.class).get(Global.LMONTHCARDID).getPrice();
|
||||
int sinceremonthline = STableManager.getConfig(SMonthcardConfig.class).get(Global.SINCERECARDID).getPrice();
|
||||
boolean sendneed =false;
|
||||
if(info.getMonthRr()<monthline){
|
||||
info.setMonthRr(MathUtils.doubleAdd(price,info.getMonthRr()));
|
||||
if(info.getMonthRr()>=monthline){
|
||||
sendneed=true;
|
||||
user.getPlayerInfoManager().putMonthCard(Global.MONTHCARDID, (int) (System.currentTimeMillis() / 1000));
|
||||
}
|
||||
}
|
||||
if(info.getsMonthRr()<lmonthline){
|
||||
info.setsMonthRr(MathUtils.doubleAdd(price,info.getsMonthRr()));
|
||||
if(info.getsMonthRr()>=lmonthline){
|
||||
sendneed=true;
|
||||
user.getPlayerInfoManager().putMonthCard(Global.LMONTHCARDID, (int) (System.currentTimeMillis() / 1000));
|
||||
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.RECHARGE_BUY.getType(),Global.LMONTHCARDID));
|
||||
}
|
||||
}
|
||||
public static void activeMonthCard(User user,int goodId){
|
||||
// 更新月卡信息
|
||||
user.getPlayerInfoManager().getMonthCard();
|
||||
|
||||
if(info.getSinceremonth() < sinceremonthline){
|
||||
info.setSinceremonth(MathUtils.doubleAdd(price,info.getSinceremonth()));
|
||||
if(info.getSinceremonth() >= sinceremonthline){
|
||||
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(goodId);
|
||||
RechargeHandler rechargeHandler = getRechargeHandler(config.getOtype());
|
||||
AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(goodId);
|
||||
// 礼包信息
|
||||
if (bag == null){
|
||||
return;
|
||||
}
|
||||
/*long now = TimeUtils.now();
|
||||
// 时间验证
|
||||
if (now < bag.getStartTime() || now > bag.getRefreshTime()){
|
||||
return;
|
||||
}*/
|
||||
|
||||
Map<Integer, SMonthcardConfig> monthcardConfigMap = STableManager.getConfig(SMonthcardConfig.class);
|
||||
boolean sendneed =false;
|
||||
for (SMonthcardConfig monthcardConfig : monthcardConfigMap.values()) {
|
||||
if (goodId == monthcardConfig.getPrice()){
|
||||
ReceiveWelfareBag receiveWelfareBag = (ReceiveWelfareBag) bag;
|
||||
if (!receiveWelfareBag.isBought()){
|
||||
continue;
|
||||
}
|
||||
sendneed=true;
|
||||
user.getPlayerInfoManager().putMonthCard(Global.SINCERECARDID, (int) (System.currentTimeMillis() / 1000));
|
||||
// 当天零点
|
||||
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));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(sendneed){
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class AbstractWelfareBag extends MongoBase{
|
|||
LOGGER.error("礼包:{}未开启",modId);
|
||||
return false;
|
||||
}
|
||||
if(getLimit() != 0 && buyTimes >=getLimit()){
|
||||
if(getLimit() != 0 && buyTimes >= getLimit()){
|
||||
LOGGER.error("礼包:{}购买次数为:{}超过限制:{}",modId,buyTimes,getLimit());
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ public class SMonthcardConfig implements BaseConfig {
|
|||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 2022-06-06 字段用法从金额改为对应月卡的礼包id
|
||||
*/
|
||||
private int price;
|
||||
|
||||
private int[][] baseReward;
|
||||
|
|
|
|||
Loading…
Reference in New Issue