推送礼包创建报错
parent
9a2d2cc6f5
commit
6c5f1accd2
|
@ -309,7 +309,7 @@ public class BuyGoodsNewLogic {
|
|||
// 全部礼包状态推送
|
||||
sendGiftGoodsWithoutJudge(uid);
|
||||
// 推送礼包
|
||||
openPush(session,user, PushRechargeType.point_recharge.getType(),goodsId);
|
||||
openPush(session, user, PushRechargeType.point_recharge.getType(), goodsId);
|
||||
// 基础掉落
|
||||
List<int[][]> list = bag.getDropByBag();
|
||||
// 购买礼包额外补助
|
||||
|
@ -925,43 +925,48 @@ public class BuyGoodsNewLogic {
|
|||
/**
|
||||
* 发送推送礼包
|
||||
*/
|
||||
public static void openPush(ISession session,User user,int type,int star) throws Exception{
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
List<SPackPushConfig> list = SPackPushConfig.findConfigByCon(type,star);
|
||||
if(list == null){
|
||||
return;
|
||||
}
|
||||
list.sort(Comparator.comparingInt(SPackPushConfig::getPriority));
|
||||
long now = TimeUtils.now();
|
||||
int bagId = 0;
|
||||
boolean push = false;
|
||||
for(SPackPushConfig con : list){
|
||||
bagId = judgePushCondition(user,con);
|
||||
int conditionType=con.getConditionId()[0];
|
||||
int pushId = con.getId();
|
||||
int statistics = con.getStatistics();
|
||||
int count = con.getCount();
|
||||
// todo DayPushNum和AllPuthNum可以放到redis里操作
|
||||
if (statistics >0 && info.getDayPushNum(pushId)>= statistics && count > 0 && info.getAllPuthNum(pushId)>= count){
|
||||
continue;
|
||||
public static void openPush(ISession session,User user,int type,int star){
|
||||
try {
|
||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||
List<SPackPushConfig> list = SPackPushConfig.findConfigByCon(type,star);
|
||||
if(list == null){
|
||||
return;
|
||||
}
|
||||
//条件成功
|
||||
if(bagId > 0 && info.getNextPushTime() < now && info.getTypePushTimeMap(conditionType) < now){
|
||||
info.setNextPushTime(now + con.getcDTime() * TimeUtils.HOUR);
|
||||
info.setTypePushTimeMap(conditionType, now + con.getPrivateCD() * TimeUtils.HOUR);
|
||||
info.setDayPushNum(pushId,1);
|
||||
info.setAllPuthNum(pushId,1);
|
||||
push = createPushBag(bagId, user);
|
||||
break;
|
||||
list.sort(Comparator.comparingInt(SPackPushConfig::getPriority));
|
||||
long now = TimeUtils.now();
|
||||
int bagId = 0;
|
||||
boolean push = false;
|
||||
for(SPackPushConfig con : list){
|
||||
bagId = judgePushCondition(user,con);
|
||||
int conditionType=con.getConditionId()[0];
|
||||
int pushId = con.getId();
|
||||
int statistics = con.getStatistics();
|
||||
int count = con.getCount();
|
||||
// todo DayPushNum和AllPuthNum可以放到redis里操作
|
||||
if (statistics >0 && info.getDayPushNum(pushId)>= statistics && count > 0 && info.getAllPuthNum(pushId)>= count){
|
||||
continue;
|
||||
}
|
||||
//条件成功
|
||||
if(bagId > 0 && info.getNextPushTime() < now && info.getTypePushTimeMap(conditionType) < now){
|
||||
info.setNextPushTime(now + con.getcDTime() * TimeUtils.HOUR);
|
||||
info.setTypePushTimeMap(conditionType, now + con.getPrivateCD() * TimeUtils.HOUR);
|
||||
info.setDayPushNum(pushId,1);
|
||||
info.setAllPuthNum(pushId,1);
|
||||
push = createPushBag(bagId, user);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
|
||||
getGoodsBagInfo(user.getId(), goodsBagInfo);
|
||||
PlayerInfoProto.AllGiftGoodsIndication goodsBuild = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, goodsBuild, true);
|
||||
if(bagId != 0 && push){
|
||||
PlayerInfoProto.PushWelfareResponse pushWelfareResponse = PlayerInfoProto.PushWelfareResponse.newBuilder().addId(bagId).build();
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_WELFARE_RESPONSE.getNumber(), pushWelfareResponse, true);
|
||||
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
|
||||
getGoodsBagInfo(user.getId(), goodsBagInfo);
|
||||
PlayerInfoProto.AllGiftGoodsIndication goodsBuild = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, goodsBuild, true);
|
||||
if(bagId != 0 && push){
|
||||
PlayerInfoProto.PushWelfareResponse pushWelfareResponse = PlayerInfoProto.PushWelfareResponse.newBuilder().addId(bagId).build();
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_WELFARE_RESPONSE.getNumber(), pushWelfareResponse, true);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
LOGGER.error("创建推送礼包报错,uid:{},触发礼包id:{},type:{}, 异常:{}",user.getId(), star, type, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue