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

back_recharge
xuexinpeng 2021-04-29 16:31:29 +08:00
commit a63900a3ec
5 changed files with 76 additions and 9 deletions

View File

@ -27,7 +27,7 @@ require("Modules.Battle.Logic.SkillManager")
require("Modules.Battle.Logic.OutDataManager")
require("Modules.Battle.Logic.BattleLogManager")
require("Modules.Battle.Logic.Monster.MonsterManager")
require "Modules/Battle/Data/ConfigData"
local BattleMain = {}
local BattleLogic = BattleLogic
@ -282,4 +282,12 @@ function BattleMain.Execute(args, fightData, optionData)
return { result = -1 }
end
function BattleMain.TestExcute(data, seed, battleType, round, uid)
if type(data) == "string" then
data = loadstring("return "..data)()
end
local resultList = BattleMain.Execute({seed = seed, type = battleType, maxRound = round}, data, {uid = uid})
print(PrintTable(resultList))
end
return BattleMain

View File

@ -74,7 +74,7 @@ public class PlayerManager extends MongoBase {
private Set<Integer> reds = new CopyOnWriteArraySet<>();
// private RechargeInfo rechargeInfo;
private NewRechargeInfo newRechargeInfo;
private NewRechargeInfo newRechargeInfo = new NewRechargeInfo();
private Map<Integer,Integer> monthCard = new HashMap<>();//月卡信息
private Set<Integer> monthCardDailyTake = new HashSet<>();

View File

@ -67,6 +67,7 @@ public class BuyGoodsNewLogic {
*
*/
public static boolean refreshWelfareState(User user) throws Exception {
dailyRefresh(user);
sendDailyMailReward(user);
boolean needChange = false;
List<AbstractWelfareBag> pAddList = new ArrayList<>();
@ -668,8 +669,16 @@ public class BuyGoodsNewLogic {
PlayerInfoProto.AllGiftGoodsIndication goodsBuild = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, goodsBuild, true);
if(popup != 0){
PlayerInfoProto.PushWelfareResponse pushWelfareResponse = PlayerInfoProto.PushWelfareResponse.newBuilder().addId(popup).build();
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.PUSH_WELFARE_RESPONSE.getNumber(), pushWelfareResponse, true);
if(popup == 21 || popup == 400 || popup == 401 || popup == 402 ){
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<>();
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
for(AbstractWelfareBag bag : info.getTimeLimitBagList()){
CommonProto.GoodsTypeDuration goodsTypeDuration = CommonProto.GoodsTypeDuration.newBuilder()
.setGoodsType(bag.getModId()).setEndTime((int)(bag.getEndTime()/1000)).build();
list.add(goodsTypeDuration);
if(bag.getType() == RechargeType.receive.getType()){
CommonProto.GoodsTypeDuration goodsTypeDuration = CommonProto.GoodsTypeDuration.newBuilder()
.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;
}
@ -767,6 +782,9 @@ public class BuyGoodsNewLogic {
int nowTime = (int)(System.currentTimeMillis()/1000);
for(int i = 1;i<=cDay;i++){
SLuxuryFund fund = SLuxuryFund.getByFoundIdAndDay(type,startDay+i);
if(fund==null){
continue;
}
SRechargeCommodityNewConfig config = SRechargeCommodityNewConfig.getConfigById(type);
String reward = ItemUtil.getMailReward(fund.getreward());
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);
}
}
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 long nextPushTime; //上次推送时间
private long lastRefreshTime;
private int TEMP_LIMIT = 2;//临时五星成长礼每天最多两次
public boolean checkOneGoodsIsOverTimeByPrivilege(int privilegeId){
for(AbstractWelfareBag bag : perpetualMap.values()){
@ -55,7 +58,8 @@ public class NewRechargeInfo extends MongoBase {
}
}
for(AbstractWelfareBag bag : receiveMap.values()){
if(bag.isOpen() && bag.getEndTime() > 0){
bag = (ReceiveWelfareBag)bag;
if(((ReceiveWelfareBag) bag).isBought()){
list.add(bag);
}
}
@ -253,4 +257,22 @@ public class NewRechargeInfo extends MongoBase {
this.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);
}
}
@ -64,12 +64,22 @@ public class ReceiveWelfareBag extends AbstractWelfareBag {
}
}
setBought(true);
setStartTime(TimeUtils.getTodayZero());
if(getDailyUpdate()>0){
setRefreshTime(getStartTime() + getDailyUpdate() * TimeUtils.DAY);
}
if(getEndTime()!=0){
setEndTime(TimeUtils.getTodayZero() + getContinueDays() * TimeUtils.DAY);
}
return true;
}
@Override
public void refresh(){
super.refresh();
setStartTime(System.currentTimeMillis());
}
private boolean bought ;
public boolean isBought() {