合服代码修改
parent
3ecd85d16b
commit
8a85fd6ed3
|
@ -1,29 +1,29 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
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.KTEnvironmentUtil;
|
||||
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.ktbeans.*;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.UserRecentLoginInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.server.Blocker;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import util.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.StringUtil;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
|
@ -50,8 +50,7 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
|
|||
ParamEnvironmentBean paramEnvironmentBean = new ParamEnvironmentBean();
|
||||
paramEnvironmentBean.setDevice_id_s(loginRequest.getDeviceIdS());
|
||||
paramEnvironmentBean.setIp_s(loginRequest.getIpS());
|
||||
ParamEnvironmentSimpleBean paramEnvironmentSimpleBean = new ParamEnvironmentSimpleBean("",
|
||||
"",
|
||||
ParamEnvironmentSimpleBean paramEnvironmentSimpleBean = new ParamEnvironmentSimpleBean("", "",
|
||||
loginRequest.getDeviceIdS(),
|
||||
loginRequest.getBrandS(),
|
||||
loginRequest.getDpiS(),
|
||||
|
@ -89,27 +88,26 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
|
|||
String pack_Id = "";
|
||||
String channelS = loginRequest.getChannelS();
|
||||
String[] splitChannelS = channelS.split("#");
|
||||
if(splitChannelS.length==1){
|
||||
// if(!StringUtil.isEmpty(splitChannelS[0])){
|
||||
// pid = Integer.valueOf(splitChannelS[0]);
|
||||
// }
|
||||
}else if (splitChannelS.length==2){
|
||||
if(!StringUtil.isEmpty(splitChannelS[0])){
|
||||
channle_id = splitChannelS[0];
|
||||
}
|
||||
if(!StringUtil.isEmpty(splitChannelS[1])){
|
||||
bundle_id = splitChannelS[1];
|
||||
}
|
||||
}else if(splitChannelS.length==3){
|
||||
if(!StringUtil.isEmpty(splitChannelS[0])){
|
||||
channle_id = splitChannelS[0];
|
||||
}
|
||||
if(!StringUtil.isEmpty(splitChannelS[1])){
|
||||
bundle_id = splitChannelS[1];
|
||||
}
|
||||
if(!StringUtil.isEmpty(splitChannelS[2])){
|
||||
pack_Id = splitChannelS[2];
|
||||
}
|
||||
switch (splitChannelS.length) {
|
||||
case 2:
|
||||
if (!StringUtil.isEmpty(splitChannelS[0])) {
|
||||
channle_id = splitChannelS[0];
|
||||
}
|
||||
if (!StringUtil.isEmpty(splitChannelS[1])) {
|
||||
bundle_id = splitChannelS[1];
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (!StringUtil.isEmpty(splitChannelS[0])) {
|
||||
channle_id = splitChannelS[0];
|
||||
}
|
||||
if (!StringUtil.isEmpty(splitChannelS[1])) {
|
||||
bundle_id = splitChannelS[1];
|
||||
}
|
||||
if (!StringUtil.isEmpty(splitChannelS[2])) {
|
||||
pack_Id = splitChannelS[2];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
LOGGER.info("LOGIN_REQUEST the uid={},the pid={},the gid={},",userId,pid,gid);
|
||||
|
@ -131,10 +129,10 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
|
|||
UserRecentLoginInfo userRecentLoginInfo = new UserRecentLoginInfo(System.currentTimeMillis()/1000,user.getPlayerInfoManager().getLevel()
|
||||
,user.getPlayerInfoManager().getRootId()
|
||||
,user.getPlayerInfoManager().getNickName());
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.USER_SERVER_INFO,openIdFront,String.valueOf(GameApplication.serverId),userRecentLoginInfo);
|
||||
|
||||
PlayerInfoProto.LoginResponse loginResponse
|
||||
= PlayerInfoProto.LoginResponse.newBuilder()
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.USER_SERVER_INFO,openIdFront,loginRequest.getServerId(),userRecentLoginInfo);
|
||||
|
||||
PlayerInfoProto.LoginResponse loginResponse = PlayerInfoProto.LoginResponse.newBuilder()
|
||||
.setResultCode(0)
|
||||
.setNewToken(String.valueOf(iSession.getToken()))
|
||||
.build();
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.ljsd.jieling.db.redis.RedisUtil;
|
|||
import com.ljsd.jieling.logic.dao.root.GuildApply;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildLog;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
|
||||
import com.ljsd.jieling.logic.family.GuildCrossHandler.BaseCrossHandler;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
|
@ -28,11 +27,10 @@ public class GuilidManager {
|
|||
|
||||
public static Map<Integer, BaseCrossHandler> baseCrossHandlerHashMap = new HashMap<>();
|
||||
|
||||
public static void addGuildInfo(GuildInfo guildInfo) throws Exception {
|
||||
public static void addGuildInfo(GuildInfo guildInfo) {
|
||||
saveOrUpdateGuildInfo(guildInfo);
|
||||
MongoTemplate otherMonogTemplate = MongoUtil.getInstence().getMonogTemplate(guildInfo.getServerId());
|
||||
otherMonogTemplate.save(guildInfo);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_NAMES, "", guildInfo.getName(), Integer.toString(guildInfo.getId()));
|
||||
}
|
||||
|
||||
public static void saveOrUpdateGuildInfo(GuildInfo guildInfo) {
|
||||
|
@ -44,43 +42,36 @@ public class GuilidManager {
|
|||
}
|
||||
|
||||
public static GuildInfo getGuildInfoByName(String guildName){
|
||||
String guildId = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_NAMES, "", guildName, String.class);
|
||||
if (guildId == null || guildId.isEmpty()) {
|
||||
return null;
|
||||
Map<String, GuildInfo> guildInfoMap = RedisUtil.getInstence().getMapValues2(RedisKey.FAMILY_INFO, "", String.class, GuildInfo.class);
|
||||
for (GuildInfo value : guildInfoMap.values()) {
|
||||
if (value.getName().equals(guildName)){
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return getGuildInfo(Integer.parseInt(guildId));
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Map<Integer, GuildInfo> getAllGuildInfos(){
|
||||
Map<String, String> mapValues = RedisUtil.getInstence().getMapValues2(RedisKey.FAMILY_NAMES, "", String.class, String.class);
|
||||
if (mapValues == null || mapValues.isEmpty()) {
|
||||
return new HashMap<>(0);
|
||||
}
|
||||
Map<Integer, GuildInfo> allGuildInfos = new HashMap<>(mapValues.size());
|
||||
for (Map.Entry<String, String> entry : mapValues.entrySet()) {
|
||||
GuildInfo guildInfo = getGuildInfo(Integer.parseInt(entry.getValue()));
|
||||
if (guildInfo == null) {
|
||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.FAMILY_NAMES, "", entry.getKey());
|
||||
continue;
|
||||
}
|
||||
allGuildInfos.put(guildInfo.getId(), guildInfo);
|
||||
Map<String, GuildInfo> guildInfoMap = RedisUtil.getInstence().getMapValues2(RedisKey.FAMILY_INFO, "", String.class, GuildInfo.class);
|
||||
Map<Integer, GuildInfo> allGuildInfos = new HashMap<>(guildInfoMap.size());
|
||||
for (Map.Entry<String, GuildInfo> entry : guildInfoMap.entrySet()) {
|
||||
allGuildInfos.put(Integer.parseInt(entry.getKey()), entry.getValue());
|
||||
}
|
||||
return allGuildInfos;
|
||||
}
|
||||
|
||||
public static int getAllGuildCount(){
|
||||
Map<String, String> mapValues = RedisUtil.getInstence().getMapValues2(RedisKey.FAMILY_NAMES, "", String.class, String.class);
|
||||
if (mapValues == null || mapValues.isEmpty()) {
|
||||
Map<String, GuildInfo> guildInfoMap = RedisUtil.getInstence().getMapValues2(RedisKey.FAMILY_INFO, "", String.class, GuildInfo.class);
|
||||
if (guildInfoMap == null || guildInfoMap.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
return mapValues.size();
|
||||
return guildInfoMap.size();
|
||||
}
|
||||
|
||||
public static void removeGuildInfo(GuildInfo guildInfo){
|
||||
System.out.println("此处删除了工会信息"+guildInfo.getId());
|
||||
int guildId = guildInfo.getId();
|
||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.FAMILY_INFO, "", String.valueOf(guildId));
|
||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.FAMILY_NAMES, "", guildInfo.getName());
|
||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.FAMILY_LOGS, "", String.valueOf(guildId));
|
||||
MongoTemplate otherMonogTemplate = MongoUtil.getInstence().getMonogTemplate(guildInfo.getServerId());
|
||||
otherMonogTemplate.remove(new BasicQuery(new BasicDBObject("_id",guildId)),"guildInfo");
|
||||
|
@ -181,20 +172,9 @@ public class GuilidManager {
|
|||
}
|
||||
}
|
||||
|
||||
public static Collection<GuildInfo> recommandGuild(User user) {
|
||||
Map<String, String> mapValues = RedisUtil.getInstence().getMapValues2(RedisKey.FAMILY_NAMES, "", String.class, String.class);
|
||||
if (mapValues == null || mapValues.isEmpty()) {
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
List<GuildInfo> guildInfo = new ArrayList<>(mapValues.size());
|
||||
for (Map.Entry<String, String> entry : mapValues.entrySet()) {
|
||||
GuildInfo mapEntry = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_INFO, "", entry.getValue(), GuildInfo.class);
|
||||
if (mapEntry == null) {
|
||||
continue;
|
||||
}
|
||||
guildInfo.add(mapEntry);
|
||||
}
|
||||
return guildInfo;
|
||||
public static Collection<GuildInfo> recommandGuild() {
|
||||
Map<String, GuildInfo> guildInfoMap = RedisUtil.getInstence().getMapValues2(RedisKey.FAMILY_INFO, "", String.class, GuildInfo.class);
|
||||
return guildInfoMap.values();
|
||||
}
|
||||
|
||||
public static void addGuildToRelease(GuildInfo guildInfo) {
|
||||
|
|
|
@ -213,6 +213,7 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
|||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
updateString("id",id);
|
||||
}
|
||||
|
||||
public void setLevel(int level){
|
||||
|
|
|
@ -221,7 +221,7 @@ public class GuildLogic {
|
|||
MessageUtil.sendMessage(session,1,msgId,build,true);
|
||||
}
|
||||
|
||||
public static void checkForCreateGuild( User user,String familyName,String announce) throws Exception {
|
||||
public static void checkForCreateGuild(User user,String familyName,String announce) throws Exception {
|
||||
if(StringUtil.isEmpty(familyName)){
|
||||
throw new ErrorCodeException(ErrorCode.NULL_NAME);
|
||||
}
|
||||
|
@ -245,9 +245,8 @@ public class GuildLogic {
|
|||
*/
|
||||
public static void recommendFamily(ISession session,Family.FamilyRecommandRequest proto) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
|
||||
Collection<GuildInfo> guildInfos = GuilidManager.recommandGuild(user);
|
||||
Collection<GuildInfo> guildInfos = GuilidManager.recommandGuild();
|
||||
Family.FamilyRecommandResponse.Builder builder = Family.FamilyRecommandResponse.newBuilder();
|
||||
Map<Integer, GuildApply> applyGuildInfos = GuilidManager.getApplyGuildInfos(uid, 1);
|
||||
int now = TimeUtils.nowInt();
|
||||
|
|
Loading…
Reference in New Issue