master_haizei01
parent
b01eb7517a
commit
b5a179b74b
|
@ -887,43 +887,48 @@ public class BuyGoodsNewLogic {
|
||||||
/**
|
/**
|
||||||
* 发送推送礼包
|
* 发送推送礼包
|
||||||
*/
|
*/
|
||||||
public static void openPush(ISession session,User user,int type,int star) throws Exception{
|
public static void openPush(ISession session,User user,int type,int star){
|
||||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
try {
|
||||||
List<SPackPushConfig> list = SPackPushConfig.findConfigByCon(type,star);
|
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||||
if(list == null){
|
List<SPackPushConfig> list = SPackPushConfig.findConfigByCon(type,star);
|
||||||
return;
|
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;
|
|
||||||
}
|
}
|
||||||
//条件成功
|
list.sort(Comparator.comparingInt(SPackPushConfig::getPriority));
|
||||||
if(bagId > 0 && info.getNextPushTime() < now && info.getTypePushTimeMap(conditionType) < now){
|
long now = TimeUtils.now();
|
||||||
info.setNextPushTime(now + con.getcDTime() * TimeUtils.HOUR);
|
int bagId = 0;
|
||||||
info.setTypePushTimeMap(conditionType, now + con.getPrivateCD() * TimeUtils.HOUR);
|
boolean push = false;
|
||||||
info.setDayPushNum(pushId,1);
|
for(SPackPushConfig con : list){
|
||||||
info.setAllPuthNum(pushId,1);
|
bagId = judgePushCondition(user,con);
|
||||||
push = createPushBag(bagId, user);
|
int conditionType=con.getConditionId()[0];
|
||||||
break;
|
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());
|
||||||
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityNewConfig.configMap.size());
|
getGoodsBagInfo(user.getId(), goodsBagInfo);
|
||||||
getGoodsBagInfo(user.getId(), goodsBagInfo);
|
PlayerInfoProto.AllGiftGoodsIndication goodsBuild = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
|
||||||
PlayerInfoProto.AllGiftGoodsIndication goodsBuild = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
|
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, goodsBuild, true);
|
||||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, goodsBuild, true);
|
if(bagId != 0 && push){
|
||||||
if(bagId != 0 && push){
|
PlayerInfoProto.PushWelfareResponse pushWelfareResponse = PlayerInfoProto.PushWelfareResponse.newBuilder().addId(bagId).build();
|
||||||
PlayerInfoProto.PushWelfareResponse pushWelfareResponse = PlayerInfoProto.PushWelfareResponse.newBuilder().addId(bagId).build();
|
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_WELFARE_RESPONSE.getNumber(), pushWelfareResponse, true);
|
||||||
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