登陆文件
parent
d94a14e846
commit
82656eeda1
|
@ -59,6 +59,7 @@ public class CarDelayFunction implements FunctionManager {
|
|||
LOGGER.error("跨服车迟斗法,发奖, key:{} 跨服分组 ={},锁状态:{},未获取到锁",lockKey, crossGroup, lock);
|
||||
return;
|
||||
}
|
||||
RedisUtil.getInstence().expireMills(lockKey, TimeUtils.ONE_HOUR);
|
||||
personRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(personRank.getCrossRedisKey(), "", 0, -1, false);
|
||||
guildRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(guildRank.getCrossRedisKey(), "", 0, -1, false);
|
||||
}else {
|
||||
|
|
|
@ -3,13 +3,11 @@ 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.ParamEnvironmentBean;
|
||||
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;
|
||||
|
@ -39,7 +37,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;
|
||||
|
@ -47,9 +45,9 @@ 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());
|
||||
// ParamEnvironmentBean paramEnvironmentBean = new ParamEnvironmentBean();
|
||||
// paramEnvironmentBean.setDevice_id_s(loginRequest.getDeviceIdS());
|
||||
// paramEnvironmentBean.setIp_s(loginRequest.getIpS());
|
||||
ParamEnvironmentSimpleBean paramEnvironmentSimpleBean = new ParamEnvironmentSimpleBean("", "",
|
||||
loginRequest.getDeviceIdS(),
|
||||
loginRequest.getBrandS(),
|
||||
|
@ -71,16 +69,13 @@ 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 = "";
|
||||
|
@ -109,7 +104,6 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
LOGGER.info("LOGIN_REQUEST the uid={},the pid={},the gid={},",userId,pid,gid);
|
||||
//登陆注册入内存
|
||||
String openIdFront = loginRequest.getOpenId();
|
||||
|
@ -120,16 +114,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 {
|
||||
|
@ -137,8 +131,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();
|
||||
}
|
||||
|
|
|
@ -277,10 +277,13 @@ public class ActivityLogic implements IEventHandler{
|
|||
}
|
||||
|
||||
public void newPlayerOpenActivityMission(User user) throws Exception {
|
||||
long now = TimeUtils.now();
|
||||
checkActivityOfUser(user, null);
|
||||
LOGGER.info("初始化玩家活动耗时1:{}",TimeUtils.now() - now);
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
if (null != session)
|
||||
if (null != session) {
|
||||
sendLuckWheelPool(user, session);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkNeedOpenStore(User user,int storeId,long startTime,long endTime) throws Exception {
|
||||
|
@ -347,7 +350,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
*/
|
||||
public Set<Integer> checkActivityOfUser(User user, PlayerInfoProto.ActivityUpateIndication.Builder builder) throws Exception {
|
||||
long now = TimeUtils.now();
|
||||
if(user==null){
|
||||
if(user == null){
|
||||
return new HashSet<>(1);
|
||||
}
|
||||
ActivityManager activityManager = user.getActivityManager();
|
||||
|
@ -461,6 +464,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
goRewardActivity(user, activityId, builder, isRemove);
|
||||
}
|
||||
}
|
||||
LOGGER.info("校验活动耗时,uid:{},耗时:{}",user.getId(), TimeUtils.now() - now);
|
||||
return openNewActivityIds;
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ public enum ActivityTypeEnum {
|
|||
FABAO_BOOK_REWARD(ActivityType.FABAO_BOOK_REWARD,FabaoBookRewardActivity::new),//法宝图鉴宝箱
|
||||
DRAW_FABAO_LV_CHEST(ActivityType.DRAW_FABAO_LV_CHEST,DrawLvChestActivity::new),//抽卡等级宝箱
|
||||
TIAN_JIANG_GIFT(ActivityType.TIAN_JIANG_GIFT,DefaultEmptyActivity::new),//天降礼包
|
||||
DA_NAO_TIAN_GONG(ActivityType.DA_NAO_TIAN_GONG, ExpeditionActivity::new),//大闹天宫
|
||||
// DA_NAO_TIAN_GONG(ActivityType.DA_NAO_TIAN_GONG, ExpeditionActivity::new),//大闹天宫
|
||||
LINGLONG_BAOJING_TASK(ActivityType.LINGLONG_BAOJING_TASK, DefaultEmptyActivity::new),//玲珑宝镜任务
|
||||
NOVICE_GEM_CHEST(ActivityType.NOVICE_GEM_CHEST, GemChestActivity::new),//初级命石宝箱
|
||||
ADVANCED_GEM_CHEST(ActivityType.ADVANCED_GEM_CHEST, GemChestActivity::new),//高级命石宝箱
|
||||
|
|
|
@ -106,13 +106,16 @@ public class UserManager {
|
|||
}
|
||||
|
||||
public static User userLogin(int uid,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id,String ccId,String pack_Id) throws Exception {
|
||||
long now = TimeUtils.now();
|
||||
User user;
|
||||
if (!UserManager.isUserExist(uid)){
|
||||
user = MongoUtil.getInstence().getMyMongoTemplate().findById(User.getCollectionName(), uid, User.class);
|
||||
LOGGER.info("玩家登陆耗时2:{}",TimeUtils.now()-now);
|
||||
now = TimeUtils.now();
|
||||
if (user == null) {
|
||||
user = registerUser(uid,openId,channel,pid,gid,platform,ip,channle_id,bundle_id,ccId,pack_Id);
|
||||
LOGGER.info("玩家登陆耗时3:{}",TimeUtils.now()-now);
|
||||
}
|
||||
UserManager.addUser(user);
|
||||
}else{
|
||||
user = getUser(uid);
|
||||
user.getPlayerInfoManager().setGid(gid);
|
||||
|
@ -124,17 +127,22 @@ public class UserManager {
|
|||
|
||||
|
||||
private static User registerUser(int uid,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id,String ccId,String pack_Id) throws Exception {
|
||||
long now = TimeUtils.now();
|
||||
User user = new User(uid);
|
||||
UserManager.addUser(user);
|
||||
now = TimeUtils.now();
|
||||
initPlayer(user,openId,channel,pid,gid,platform,ip,channle_id,bundle_id,ccId,pack_Id);
|
||||
LOGGER.info("注册玩家耗时2:{}", TimeUtils.now() - now);
|
||||
now = TimeUtils.now();
|
||||
MongoUtil.getInstence().getMyMongoTemplate().save(user.getId(),user);
|
||||
LOGGER.info("注册玩家耗时3:{}", TimeUtils.now() - now);
|
||||
return user;
|
||||
}
|
||||
|
||||
private static void initPlayer(User user,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id,String ccId,String pack_Id) throws Exception {
|
||||
long now = TimeUtils.now();
|
||||
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
|
||||
PlayerManager playerManager = user.getPlayerInfoManager();
|
||||
long now = TimeUtils.now();
|
||||
playerManager.setNickName(Integer.toString(user.getId()));
|
||||
playerManager.setNameColor("F6E1B6");
|
||||
playerManager.setOpenId(openId);
|
||||
|
@ -185,19 +193,29 @@ public class UserManager {
|
|||
user.getUserMissionManager().onGameEvent(user, GameEvent.BEGINNER);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.VIP_LEVLUP, MissionType.VIP_LEVEL,0);
|
||||
Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.LOGIN_TIMES.getType(),1));
|
||||
now = TimeUtils.now();
|
||||
ActivityLogic.getInstance().newPlayerOpenActivityMission(user);
|
||||
LOGGER.info("初始化玩家耗时11:{}", TimeUtils.now() - now);
|
||||
now = TimeUtils.now();
|
||||
Poster.getPoster().dispatchEvent(new EveryDayDiscountUnlockEvent(user.getId()));
|
||||
LOGGER.info("初始化玩家耗时12:{}", TimeUtils.now() - now);
|
||||
now = TimeUtils.now();
|
||||
ItemUtil.drop(user,gameSetting.getBornItem(), BIReason.USER_BORN_REWARD);
|
||||
LOGGER.info("初始化玩家耗时13:{}", TimeUtils.now() - now);
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
Map<String, Hero> heroMap = heroManager.getHeroMap();
|
||||
TeamPosManager teamPosManager = user.getTeamPosManager();
|
||||
List<Hero> teamHeros = new ArrayList<>(1);
|
||||
teamHeros.add(heroMap.values().iterator().next());
|
||||
teamPosManager.addTeamOfInitPlayer(teamHeros);
|
||||
now = TimeUtils.now();
|
||||
long force = HeroLogic.getInstance().calTeamTotalForce(user, 1);
|
||||
LOGGER.info("初始化玩家耗时15:{}", TimeUtils.now() - now);
|
||||
playerManager.setMaxForce(force);
|
||||
user.getExpeditionManager().setExpeditionLeve(1);
|
||||
now = TimeUtils.now();
|
||||
CrossServiceLogic.getInstance().saveBasicPlayerToRedis(user);//初始化角色
|
||||
LOGGER.info("初始化玩家耗时16:{}", TimeUtils.now() - now);
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.CREATE_ROLE.getType());//先发送注册事件
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,14 @@ import com.ljsd.jieling.jbean.gm.GmActivityManager;
|
|||
import com.ljsd.jieling.logic.dao.*;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.mongodb.core.index.CompoundIndex;
|
||||
import org.springframework.data.mongodb.core.index.CompoundIndexes;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
@Document
|
||||
@CompoundIndex(def = "{'playerManager.level' : 1, 'playerManager.loginTime': 1}", name = "level_loginTime_idx")
|
||||
@CompoundIndexes({
|
||||
@CompoundIndex(name = "unique_id", def = "{'_id': 1}"),
|
||||
@CompoundIndex(name = "level_loginTime_idx", def = "{'playerManager.level' : 1, 'playerManager.loginTime': 1}")
|
||||
})
|
||||
public class User {
|
||||
|
||||
public static final String _COLLECTION_NAME = "user";
|
||||
|
|
|
@ -62,9 +62,6 @@ public class RankLogic {
|
|||
LOGGER.info("获取排行榜信息type={},activityId={}",type,activityId);
|
||||
String rkey = activityId==0 ? "" : String.valueOf(activityId);
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if (crossGroup < 0){
|
||||
LOGGER.error("服务器验证未跨服,跨服id:{}",crossGroup);
|
||||
}
|
||||
PlayerInfoProto.RankResponse rankResponse;
|
||||
AbstractRank rank = RankContext.getRankEnum(type);
|
||||
if(RankContext.isCrossRank(type) && isCross == 1 && crossGroup > 0){//跨服
|
||||
|
|
Loading…
Reference in New Issue