网页支付玩家定制化商品列表

back_recharge
zhangshanxue 2020-09-15 16:15:59 +08:00
parent 5cf95e7e09
commit f4dc939fc2
2 changed files with 96 additions and 1 deletions

View File

@ -13,6 +13,8 @@ import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.jbean.ActivityManager;
import com.ljsd.jieling.jbean.ActivityMission;
import com.ljsd.jieling.ktbeans.KtEventUtils;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
@ -825,6 +827,53 @@ public class BuyGoodsLogic {
for(SRechargeCommodityConfig sRechargeCommodityConfig :SRechargeCommodityConfig.rechargeCommodityConfigMap.values()){
int limit = sRechargeCommodityConfig.getLimit();
int goodsId = sRechargeCommodityConfig.getId();
//check family
if (sRechargeCommodityConfig.getType() == 10 && user.getPlayerInfoManager().getGuildId() == 0) {
continue;
}else if(sRechargeCommodityConfig.getType() == 11){
Set<Integer> ids =getOpenActivity(user,8);
if(ids.size()==0){
continue;
}
}else if(sRechargeCommodityConfig.getType() == 12){
Set<Integer> ids =getOpenActivity(user,54);
if(ids.size()==0){
continue;
}
}
if(SGlobalActivity.sRechargeId2ActivityId.containsKey(goodsId)){
Integer integer = SGlobalActivity.sRechargeId2ActivityId.get(goodsId);
Set<Integer> ids =getOpenActivity(user,6);
if(!ids.contains(integer)){
continue;
}
}
//临时处理 商品控制需要重新处理
if(goodsId>=314&&goodsId<=355)
{
continue;
}
//临时处理 商品控制需要重新处理
if(goodsId>=300&&goodsId<=306)
{
Set<Integer> ids =getOpenActivity(user,20001);
if(ids.size()==0){
continue;
}
}
//临时处理 商品控制需要重新处理
if(goodsId>=300&&goodsId<=317)
{
Set<Integer> ids =getOpenActivity(user,20002);
if(ids.size()==0){
continue;
}
}
Integer buyTimes = buyGoodsTimes.get(goodsId);
if(buyTimes ==null){
buyTimes=0;
@ -833,7 +882,22 @@ public class BuyGoodsLogic {
if(buyTimes>=limit){
continue;
}
}else {
if(sRechargeCommodityConfig.getTime()==4&&(sRechargeCommodityConfig.getDiscountType().length==3||sRechargeCommodityConfig.getDiscountType().length==4)){
int[] discountType = sRechargeCommodityConfig.getDiscountType();
int temptype = discountType[0];
if(temptype == 4||temptype==3){
int dytime = rechargeInfo.getDyGoodsCanBuyTimes().getOrDefault(goodsId,0)-1;
if(dytime <0){
continue;
}
}
}
}
long startTime=0;
long endTime=0;
int dybuytime = 0;
@ -867,4 +931,26 @@ public class BuyGoodsLogic {
}
private static Set<Integer> getOpenActivity(User user,int activityType){
Set<Integer> ids = new HashSet<>();
ActivityManager activityManager = user.getActivityManager();
Map<Integer, ActivityMission> activityMissionMap = activityManager.getActivityMissionMap();
for (Map.Entry<Integer, ActivityMission> item : activityMissionMap.entrySet()) {
ActivityMission activityMission = item.getValue();
if (activityMission.getActivityState() != ActivityType.OPEN_STATE) {
continue;
}
Integer activityId = item.getKey();
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
int targetActivityType = sGlobalActivity.getType();
if (targetActivityType != activityType) {
continue;
}
ids.add(activityId);
}
return ids;
}
}

View File

@ -53,13 +53,17 @@ public class SGlobalActivity implements BaseConfig {
public static Map<Integer, List<SGlobalActivity>> sGlobalActivityMapByType;
public static Map<Integer, List<SGlobalActivity>> sGlobalActivityMapByOpenRules;
public static Map<Integer, Integer> sRechargeId2ActivityId;
@Override
public void init() throws Exception {
Map<Integer, List<SGlobalActivity>> sGlobalActivityMapByTypeTmp = new HashMap<>();
Map<Integer, List<SGlobalActivity>> sGlobalActivityMapByOpenRulesTmp = new HashMap<>();
Map<Integer,Integer> sRechargeId2ActivityIdTemp = new HashMap<>();
Map<Integer, SGlobalActivity> config = STableManager.getConfig(SGlobalActivity.class);
for(SGlobalActivity sGlobalActivity : config.values()){
if(sGlobalActivity.getCanBuyRechargeId()!=0){
sRechargeId2ActivityIdTemp.put(sGlobalActivity.getCanBuyRechargeId(),sGlobalActivity.getId());
}
sGlobalActivityMapByTypeTmp.computeIfAbsent(sGlobalActivity.getType(),n->new ArrayList<>()).add(sGlobalActivity);
if(sGlobalActivity.getOpenRules().length>0){
sGlobalActivityMapByOpenRulesTmp.computeIfAbsent(sGlobalActivity.getOpenRules()[0],n->new ArrayList<>()).add(sGlobalActivity);
@ -79,10 +83,15 @@ public class SGlobalActivity implements BaseConfig {
sGlobalActivity.setStartTimeLong(Long.parseLong(startTime));
sGlobalActivity.setEndTimeLong(Long.parseLong(endtime));
}
sGlobalActivityMap = config;
sGlobalActivityMapByType = sGlobalActivityMapByTypeTmp;
sGlobalActivityMapByOpenRules = sGlobalActivityMapByOpenRulesTmp;
sRechargeId2ActivityId = sRechargeId2ActivityIdTemp;
}
public static Map<Integer, SGlobalActivity> getsGlobalActivityMap() {