Merge branch 'refs/heads/master_xiyou' into master_zzxx
# Conflicts: # serverlogic/src/main/java/com/ljsd/jieling/handler/LoginRequestHandler.javamaster_zzxx
commit
7393d60955
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"version":"6",
|
||||
"tables":"GameSetting"
|
||||
"version":"7",
|
||||
"tables":"GameSetting|PackPush"
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"version":"7",
|
||||
"version":"9",
|
||||
"classes": [
|
||||
{"name":"BuyGoodsNewLogic.class","fullName":"com.ljsd.jieling.logic.store.BuyGoodsNewLogic"},
|
||||
{"name":"RetrySendIndicationThread.class","fullName":"com.ljsd.jieling.thread.task.RetrySendIndicationThread"}
|
||||
{"name":"RetrySendIndicationThread.class","fullName":"com.ljsd.jieling.thread.task.RetrySendIndicationThread"},
|
||||
{"name":"EquipLogic.class","fullName":"com.ljsd.jieling.logic.equip.EquipLogic"}
|
||||
]
|
||||
}
|
|
@ -3,11 +3,12 @@ package com.ljsd.jieling.handler;
|
|||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.ktbeans.KTDataUtil;
|
||||
import com.ljsd.jieling.ktbeans.KTRequestBeans.LoginParamType;
|
||||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamDataBean;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEnvironmentSimpleBean;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.UserRecentLoginInfo;
|
||||
|
@ -37,7 +38,7 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
|
|||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.LoginRequest loginRequest) throws Exception {
|
||||
long now = TimeUtils.now();
|
||||
|
||||
int userId = iSession.getUid();
|
||||
if(!Blocker.checkFlow(iSession)){
|
||||
return;
|
||||
|
@ -45,9 +46,6 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
|
|||
InetSocketAddress remoteAddress = iSession.getChannel().getRemoteAddress();
|
||||
loginRequest = loginRequest.toBuilder().setIpS(remoteAddress.getAddress().getHostAddress()).build();
|
||||
ReportUtil.saveBaseInfo(userId,loginRequest);
|
||||
// ParamEnvironmentBean paramEnvironmentBean = new ParamEnvironmentBean();
|
||||
// paramEnvironmentBean.setDevice_id_s(loginRequest.getDeviceIdS());
|
||||
// paramEnvironmentBean.setIp_s(loginRequest.getIpS());
|
||||
ParamEnvironmentSimpleBean paramEnvironmentSimpleBean = new ParamEnvironmentSimpleBean("", "",
|
||||
loginRequest.getDeviceIdS(),
|
||||
loginRequest.getBrandS(),
|
||||
|
@ -69,13 +67,16 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
|
|||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
ParamDataBean paramDataBean = new ParamDataBean();
|
||||
paramDataBean.setChannel_s(loginRequest.getChannelS());
|
||||
KTDataUtil.addUserDataInfo(userId,paramDataBean);
|
||||
|
||||
// KTDataUtil.addUserDataInfo(userId,paramDataBean);
|
||||
// KTEnvironmentUtil.addUserEnviromentInfo(userId,paramEnvironmentBean);
|
||||
// KTEnvironmentUtil.addUserSimpleEnviromentInfo(userId,paramEnvironmentSimpleBean);
|
||||
// KTEnvironmentUtil.addUserEnviromentInfo(userId,paramEnvironmentBean);
|
||||
|
||||
int pid = 0;
|
||||
int gid = 0;
|
||||
String channle_id = "";
|
||||
|
@ -114,16 +115,16 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
|
|||
String chanel = split[1];
|
||||
UserManager.userLogin(userId,openId,chanel,pid,gid,loginRequest.getPlatformS(),loginRequest.getIpS(),channle_id,bundle_id,ccId,pack_Id);
|
||||
}
|
||||
now = TimeUtils.now();
|
||||
User user = UserManager.userLogin(userId,openIdFront,"",pid,gid,loginRequest.getPlatformS(),loginRequest.getIpS(),channle_id,bundle_id,ccId,pack_Id);
|
||||
LOGGER.info("登陆耗时10:{}", TimeUtils.now() - now);
|
||||
now = TimeUtils.now();
|
||||
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
playerInfoManager.setLastDeviceId(loginRequest.getDeviceIdS());
|
||||
playerInfoManager.setServerId(loginRequest.getServerId());
|
||||
|
||||
UserRecentLoginInfo userRecentLoginInfo = new UserRecentLoginInfo(TimeUtils.nowInt(), playerInfoManager.getLevel(), playerInfoManager.getRootId(), playerInfoManager.getNickName());
|
||||
|
||||
RedisUtil.getInstence().old_putmap(RedisKey.USER_SERVER_INFO,openIdFront,loginRequest.getServerId(),userRecentLoginInfo);
|
||||
|
||||
PlayerInfoProto.LoginResponse loginResponse = PlayerInfoProto.LoginResponse.newBuilder().setResultCode(0).setNewToken(String.valueOf(iSession.getToken())).build();
|
||||
|
||||
try {
|
||||
|
@ -131,8 +132,8 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
|
|||
RedisUtil.getInstence().del(key);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.LOGIN_RESPONSE_VALUE, loginResponse, true);
|
||||
MapLogic.getInstance().whenLogin(user);
|
||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserLoginOutEvent,0);
|
||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserLogin,0);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserLoginOutEvent,0);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserLogin,0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -644,7 +644,7 @@ public class EquipLogic {
|
|||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
// 掉落道具
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[]{giftId, 1}, 1, BIReason.GIFT_UP_STAR_GET);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[][]{{giftId, 1}}, 1, BIReason.GIFT_UP_STAR_GET);
|
||||
HeroInfoProto.GiftEquipUpStarResponse.Builder builder = HeroInfoProto.GiftEquipUpStarResponse.newBuilder().setDrop(drop);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GiftEquipUpStarResponse_VALUE, builder.build(), true);
|
||||
}
|
||||
|
|
|
@ -312,7 +312,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();
|
||||
// 购买礼包额外补助
|
||||
|
@ -928,43 +928,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