Merge branch 'master_test_gn' into master_test_mingan

back_recharge
jiahuiwen 2021-10-22 16:08:16 +08:00
commit 8bdd217c8a
3 changed files with 42 additions and 7 deletions

View File

@ -33,6 +33,8 @@ public class RidingSwardActivity extends AbstractActivity{
// 初始化阶段奖励
ActivityLogic.getInstance().initOtherMission(mission, new ArrayList<>());
user.getActivityManager().getActivityMissionMap().put(id, mission);
// redis初始化
RedisUtil.getInstence().del(RedisUtil.getInstence().getKey(RedisKey.RIDING_SWARD_RECORD, String.valueOf(user.getId())));
LOGGER.info("御剑行初始化...{}",id);
}

View File

@ -11,8 +11,12 @@ import com.ljsd.jieling.logic.activity.event.SuperBoxEvent;
import com.ljsd.jieling.logic.dao.ServerConfig;
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.logic.store.newRechargeInfo.bean.AbstractWelfareBag;
import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.RechargeHandler;
import com.ljsd.jieling.network.session.ISession;
import config.SGlobalActivity;
import config.SRechargeCommodityNewConfig;
import config.SSurpriseBox;
import manager.STableManager;
import util.TimeUtils;
@ -97,7 +101,7 @@ public class SuperBoxActivity extends AbstractActivity {
if (box.getPackId() == giftId){
// 当前礼包状态处理
ActivityProgressInfo current = missionMap.get(box.getId());
if (current != null){
if (current != null && !checkBuyGiftCount(user,giftId)){
current.setState(ActivityType.HAD_TAKED);
current.setProgrss(8);
missionMap.put(box.getId(),current);
@ -267,6 +271,27 @@ public class SuperBoxActivity extends AbstractActivity {
return result;
}
/**
*
* @param user
* @param giftId
* @return
*/
private boolean checkBuyGiftCount(User user, int giftId){
// 礼包不存在
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(giftId);
if (config == null){
return false;
}
RechargeHandler rechargeHandler = BuyGoodsNewLogic.getRechargeHandler(config.getOtype());
AbstractWelfareBag bag = rechargeHandler.getRechargeMap(user).get(giftId);
// 是否可买
if (bag != null && bag.checkBuy()){
return true;
}
return false;
}
@Override
public Set<Integer> getCloseGoods(User user){
HashSet<Integer> set = new HashSet<>();

View File

@ -79,12 +79,7 @@ public class AbstractWelfareBag extends MongoBase{
}
public boolean buy() {
if(!open){
LOGGER.error("礼包:{}未开启",modId);
return false;
}
if(getLimit() != 0 && buyTimes >=getLimit()){
LOGGER.error("礼包:{}购买次数为:{}超过限制:{}",modId,buyTimes,getLimit());
if (!checkBuy()){
return false;
}
if(isUserBuyRefresh && getRefreshTime() == 0){
@ -94,6 +89,19 @@ public class AbstractWelfareBag extends MongoBase{
setLastBuyTime(TimeUtils.getTodayZero());
return true;
}
public boolean checkBuy() {
if(!open){
LOGGER.error("礼包:{}未开启",modId);
return false;
}
if(getLimit() != 0 && buyTimes >=getLimit()){
LOGGER.error("礼包:{}购买次数为:{}超过限制:{}",modId,buyTimes,getLimit());
return false;
}
return true;
}
public int[][] getDropByBag() throws Exception{
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(modId);
if (config == null) {