Merge branch 'master_test_gn' of http://60.1.1.230/backend/jieling_server into master_test_gn

lvxinran 2021-05-01 04:31:18 +08:00
commit 04bfe71ebf
3 changed files with 66 additions and 7 deletions

View File

@ -67,6 +67,7 @@ public class BuyGoodsNewLogic {
* *
*/ */
public static boolean refreshWelfareState(User user) throws Exception { public static boolean refreshWelfareState(User user) throws Exception {
dailyRefresh(user);
sendDailyMailReward(user); sendDailyMailReward(user);
boolean needChange = false; boolean needChange = false;
List<AbstractWelfareBag> pAddList = new ArrayList<>(); List<AbstractWelfareBag> pAddList = new ArrayList<>();
@ -668,8 +669,16 @@ public class BuyGoodsNewLogic {
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(popup != 0){ if(popup != 0){
PlayerInfoProto.PushWelfareResponse pushWelfareResponse = PlayerInfoProto.PushWelfareResponse.newBuilder().addId(popup).build(); if(popup == 21 || popup == 400 || popup == 401 || popup == 402 ){
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_WELFARE_RESPONSE.getNumber(), pushWelfareResponse, true); if(info.getTEMP_LIMIT()>0){
info.setTEMP_LIMIT(info.getTEMP_LIMIT() - 1);
PlayerInfoProto.PushWelfareResponse pushWelfareResponse = PlayerInfoProto.PushWelfareResponse.newBuilder().addId(popup).build();
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_WELFARE_RESPONSE.getNumber(), pushWelfareResponse, true);
}
}else{
PlayerInfoProto.PushWelfareResponse pushWelfareResponse = PlayerInfoProto.PushWelfareResponse.newBuilder().addId(popup).build();
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_WELFARE_RESPONSE.getNumber(), pushWelfareResponse, true);
}
} }
} }
@ -709,9 +718,15 @@ public class BuyGoodsNewLogic {
List<CommonProto.GoodsTypeDuration> list = new ArrayList<>(); List<CommonProto.GoodsTypeDuration> list = new ArrayList<>();
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo(); NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
for(AbstractWelfareBag bag : info.getTimeLimitBagList()){ for(AbstractWelfareBag bag : info.getTimeLimitBagList()){
CommonProto.GoodsTypeDuration goodsTypeDuration = CommonProto.GoodsTypeDuration.newBuilder() if(bag.getType() == RechargeType.receive.getType()){
.setGoodsType(bag.getModId()).setEndTime((int)(bag.getEndTime()/1000)).build(); CommonProto.GoodsTypeDuration goodsTypeDuration = CommonProto.GoodsTypeDuration.newBuilder()
list.add(goodsTypeDuration); .setGoodsType(bag.getModId()).setEndTime((int)((bag.getStartTime() + bag.getContinueDays() * TimeUtils.DAY)/1000)).build();
list.add(goodsTypeDuration);
}else{
CommonProto.GoodsTypeDuration goodsTypeDuration = CommonProto.GoodsTypeDuration.newBuilder()
.setGoodsType(bag.getModId()).setEndTime((int)(bag.getEndTime()/1000)).build();
list.add(goodsTypeDuration);
}
} }
return list; return list;
} }
@ -767,6 +782,9 @@ public class BuyGoodsNewLogic {
int nowTime = (int)(System.currentTimeMillis()/1000); int nowTime = (int)(System.currentTimeMillis()/1000);
for(int i = 1;i<=cDay;i++){ for(int i = 1;i<=cDay;i++){
SLuxuryFund fund = SLuxuryFund.getByFoundIdAndDay(type,startDay+i); SLuxuryFund fund = SLuxuryFund.getByFoundIdAndDay(type,startDay+i);
if(fund==null){
continue;
}
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(type); SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(type);
String reward = ItemUtil.getMailReward(fund.getreward()); String reward = ItemUtil.getMailReward(fund.getreward());
String title = SErrorCodeEerverConfig.getI18NMessage("recharge_"+config.getType()+"_daily_title"); String title = SErrorCodeEerverConfig.getI18NMessage("recharge_"+config.getType()+"_daily_title");
@ -776,4 +794,13 @@ public class BuyGoodsNewLogic {
MailLogic.getInstance().sendMail(uid,title,content,reward,nowTime, Global.MAIL_EFFECTIVE_TIME); MailLogic.getInstance().sendMail(uid,title,content,reward,nowTime, Global.MAIL_EFFECTIVE_TIME);
} }
} }
public static void dailyRefresh(User user){
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
if(TimeUtils.differentDays(info.getLastRefreshTime(),System.currentTimeMillis())<1){
return;
}
info.setLastRefreshTime(System.currentTimeMillis());
info.setTEMP_LIMIT(2);
}
} }

View File

@ -29,6 +29,9 @@ public class NewRechargeInfo extends MongoBase {
private int towerLost; //记录爬塔失败次数 private int towerLost; //记录爬塔失败次数
private long nextPushTime; //上次推送时间 private long nextPushTime; //上次推送时间
private long lastRefreshTime;
private int TEMP_LIMIT = 2;//临时五星成长礼每天最多两次
public boolean checkOneGoodsIsOverTimeByPrivilege(int privilegeId){ public boolean checkOneGoodsIsOverTimeByPrivilege(int privilegeId){
for(AbstractWelfareBag bag : perpetualMap.values()){ for(AbstractWelfareBag bag : perpetualMap.values()){
@ -55,7 +58,8 @@ public class NewRechargeInfo extends MongoBase {
} }
} }
for(AbstractWelfareBag bag : receiveMap.values()){ for(AbstractWelfareBag bag : receiveMap.values()){
if(bag.isOpen() && bag.getEndTime() > 0){ bag = (ReceiveWelfareBag)bag;
if(((ReceiveWelfareBag) bag).isBought()){
list.add(bag); list.add(bag);
} }
} }
@ -253,4 +257,22 @@ public class NewRechargeInfo extends MongoBase {
this.nextPushTime = nextPushTime; this.nextPushTime = nextPushTime;
updateString("nextPushTime",nextPushTime); updateString("nextPushTime",nextPushTime);
} }
public int getTEMP_LIMIT() {
return TEMP_LIMIT;
}
public void setTEMP_LIMIT(int TEMP_LIMIT) {
this.TEMP_LIMIT = TEMP_LIMIT;
updateString("TEMP_LIMIT",TEMP_LIMIT);
}
public long getLastRefreshTime() {
return lastRefreshTime;
}
public void setLastRefreshTime(long lastRefreshTime) {
this.lastRefreshTime = lastRefreshTime;
updateString("lastRefreshTime",lastRefreshTime);
}
} }

View File

@ -45,7 +45,7 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
} }
} }
} }
if(getDailyUpdate()>0 && getEndTime() != 0){ if(getDailyUpdate()>0){
setRefreshTime(getStartTime() + getDailyUpdate() * TimeUtils.DAY); setRefreshTime(getStartTime() + getDailyUpdate() * TimeUtils.DAY);
} }
} }
@ -64,12 +64,22 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
} }
} }
setBought(true); setBought(true);
setStartTime(TimeUtils.getTodayZero());
if(getDailyUpdate()>0){
setRefreshTime(getStartTime() + getDailyUpdate() * TimeUtils.DAY);
}
if(getEndTime()!=0){ if(getEndTime()!=0){
setEndTime(TimeUtils.getTodayZero() + getContinueDays() * TimeUtils.DAY); setEndTime(TimeUtils.getTodayZero() + getContinueDays() * TimeUtils.DAY);
} }
return true; return true;
} }
@Override
public void refresh(){
super.refresh();
setStartTime(System.currentTimeMillis());
}
private boolean bought ; private boolean bought ;
public boolean isBought() { public boolean isBought() {