修改推送礼包

master_longzhu_new
DESKTOP-C3M45P4\dengdan 2025-08-24 17:43:30 +08:00
parent 39ebc29512
commit 14e050d0ff
5 changed files with 80 additions and 5 deletions

View File

@ -37,6 +37,7 @@ import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.question.QuestionLogic;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
@ -88,6 +89,17 @@ public class GetPlayerInfoHandler extends BaseHandler{
LuofuLogic.getInstance().takeTitleReward(user);
user.getUserMissionManager().onGameEvent(user, GameEvent.ONE_MISSION_TYPE_CONSUME,MissionType.LOGIN_TIMES,0);
long now = TimeUtils.now();
// 开服时间戳
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
//推送礼包
long haveTime = now - openTime;
int nowDay = (int)(haveTime/TimeUtils.ONE_DAY) + 1;
BuyGoodsNewLogic.openPush(iSession, user, PushRechargeType.OPEN_DAY.getType(),nowDay);
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
int w = calendar.get(Calendar.DAY_OF_WEEK) - 1;
BuyGoodsNewLogic.openPush(iSession, user, PushRechargeType.WEEK_DAY.getType(),w);
playerInfoManager.setLoginTime(now);
List<CommonProto.NewPlayerGuidePoint> list = new ArrayList<>();
@ -182,8 +194,6 @@ public class GetPlayerInfoHandler extends BaseHandler{
List<CommonProto.PracticeSkillInfo> practiceSkillInfos = getPracticeSkillInfos(heroManager);
List<CommonProto.FaBaoSoulInfo> faBaoSoulInfos = getFaBaoSoulInfos(heroManager);
// 开服时间戳
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
PlayerInfoProto.GetPlayerInfoResponse getPlayerInfoResponse = PlayerInfoProto.GetPlayerInfoResponse.newBuilder()
.setPlayer(player)
.addAllNewPlayerGuidePoint(list)

View File

@ -42,6 +42,7 @@ import com.ljsd.jieling.logic.ridingSward.RidingSwardLogic;
import com.ljsd.jieling.logic.sevenworld.SevenWorldLogic;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.netty.cocdex.Tea;
import com.ljsd.jieling.network.server.ProtocolsManager;
@ -501,6 +502,14 @@ public class GlobalDataManaager implements IManager {
user.getPlayerInfoManager().getNewRechargeInfo().ClearDayPushMap();
// 清空当天在线时间
user.getPlayerInfoManager().setDayOfOnlineTime(0);
//刷新推送礼包
int nowDay = GameApplication.serverConfig.getServerOpenDay(TimeUtils.now());
BuyGoodsNewLogic.openPush(session, user, PushRechargeType.OPEN_DAY.getType(),nowDay);
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
int w = calendar.get(Calendar.DAY_OF_WEEK) - 1;
BuyGoodsNewLogic.openPush(session, user, PushRechargeType.WEEK_DAY.getType(),w);
}
user.getPlayerInfoManager().setLoginTime(TimeUtils.now());
}

View File

@ -1,10 +1,12 @@
package com.ljsd.jieling.logic.dao;
import com.ljsd.GameApplication;
import com.ljsd.common.mogodb.MongoBase;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import util.TimeUtils;
@Document( collection = "server_config")
public class ServerConfig extends MongoBase {
@ -85,4 +87,25 @@ public class ServerConfig extends MongoBase {
public void setRestartTime(String restartTime) {
this.restartTime = restartTime;
}
/**
*
* @return
*/
public long getServerOpenTimeLong(){
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
return openTime;
}
/**
*
* @param now
* @return
*/
public int getServerOpenDay(long now){
long openTime = this.getServerOpenTimeLong();
long haveTime = now - openTime;
int nowDay = (int)(haveTime/ TimeUtils.ONE_DAY) + 1;
return nowDay;
}
}

View File

@ -1140,6 +1140,16 @@ public class BuyGoodsNewLogic {
return false;
}
break;
case 21://每周指定日期礼包
int dayOfWeek = condition[1];
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
int w = calendar.get(Calendar.DAY_OF_WEEK) - 1;
if(w != dayOfWeek){
return false;
}
break;
default:break;
}
return true;
@ -1169,10 +1179,21 @@ public class BuyGoodsNewLogic {
type == PushRechargeType.XUNAXIAN_ZHOAHUAN.getType() ||
type == PushRechargeType.XIANDOU_ZHOAHUAN.getType() ||
type == PushRechargeType.QIANNENG_UP.getType()||
type == PushRechargeType.OPEN_DAY.getType()){
type == PushRechargeType.OPEN_DAY.getType()||
type == PushRechargeType.WEEK_DAY.getType()){
int[] bagIds = judgePushConditionMulti(user,con,true);
// todo DayPushNum和AllPuthNum可以放到redis里操作
if (statistics >0 && info.getDayPushNum(pushId)>= statistics && count > 0 && info.getAllPuthNum(pushId)>= count){
if (statistics >0 && info.getDayPushNum(pushId)>= statistics){
int dayPushNum = info.getDayPushNum(pushId);
long lastPushTime = info.getNextPushTime() - con.getcDTime() * TimeUtils.HOUR;
if(!TimeUtils.isSameDay(lastPushTime,now)){
dayPushNum = 0;
}
if(dayPushNum >= statistics) {
continue;
}
}
if(count > 0 && info.getAllPuthNum(pushId)>= count){
continue;
}
//条件成功
@ -1190,7 +1211,17 @@ public class BuyGoodsNewLogic {
}else{
bagId = judgePushCondition(user,con,false);
// todo DayPushNum和AllPuthNum可以放到redis里操作
if (statistics >0 && info.getDayPushNum(pushId)>= statistics && count > 0 && info.getAllPuthNum(pushId)>= count){
if (statistics >0 && info.getDayPushNum(pushId)>= statistics){
int dayPushNum = info.getDayPushNum(pushId);
long lastPushTime = info.getNextPushTime() - con.getcDTime() * TimeUtils.HOUR;
if(!TimeUtils.isSameDay(lastPushTime,now)){
dayPushNum = 0;
}
if(dayPushNum >= statistics) {
continue;
}
}
if(count > 0 && info.getAllPuthNum(pushId)>= count){
continue;
}
//条件成功

View File

@ -45,6 +45,8 @@ public enum PushRechargeType {
QIANNENG_UP(19),
//开服天数
OPEN_DAY(20),
//每周指定天数
WEEK_DAY(21),
;
private int type;