generated from root/miduo_server
获取工会成员信息报错时加入容错,继续查询下一个工会成员
parent
cd9925a2e0
commit
ad261c8d6c
|
|
@ -3,13 +3,6 @@ package com.ljsd.jieling.logic.family;
|
||||||
import com.google.protobuf.GeneratedMessage;
|
import com.google.protobuf.GeneratedMessage;
|
||||||
import com.ljsd.GameApplication;
|
import com.ljsd.GameApplication;
|
||||||
import com.ljsd.jieling.core.GlobalsDef;
|
import com.ljsd.jieling.core.GlobalsDef;
|
||||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
|
||||||
import com.ljsd.jieling.db.mongo.MongoKey;
|
|
||||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
|
||||||
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
|
||||||
import com.ljsd.jieling.logic.mission.MissionLoigc;
|
|
||||||
import com.ljsd.jieling.reportBeans_37.ChatContentType;
|
|
||||||
import com.ljsd.jieling.reportBeans_37.Repot37EventUtil;
|
|
||||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||||
import com.ljsd.jieling.db.redis.RedisKey;
|
import com.ljsd.jieling.db.redis.RedisKey;
|
||||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
|
|
@ -17,13 +10,13 @@ import com.ljsd.jieling.exception.ErrorCode;
|
||||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||||
import com.ljsd.jieling.globals.BIReason;
|
import com.ljsd.jieling.globals.BIReason;
|
||||||
import com.ljsd.jieling.globals.Global;
|
import com.ljsd.jieling.globals.Global;
|
||||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
|
||||||
import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
|
||||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
|
||||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
import com.ljsd.jieling.logic.activity.ActivityType;
|
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||||
import com.ljsd.jieling.logic.activity.IEventHandler;
|
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
||||||
import com.ljsd.jieling.logic.activity.event.*;
|
import com.ljsd.jieling.logic.activity.event.CommitSheJiEvent;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.GuildForceChangeEvent;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||||
|
import com.ljsd.jieling.logic.activity.event.UserMainTeamForceEvent;
|
||||||
import com.ljsd.jieling.logic.dao.*;
|
import com.ljsd.jieling.logic.dao.*;
|
||||||
import com.ljsd.jieling.logic.dao.root.*;
|
import com.ljsd.jieling.logic.dao.root.*;
|
||||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||||
|
|
@ -35,13 +28,16 @@ import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.*;
|
import com.ljsd.jieling.protocols.CommonProto;
|
||||||
|
import com.ljsd.jieling.protocols.Family;
|
||||||
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||||
|
import com.ljsd.jieling.reportBeans_37.ChatContentType;
|
||||||
import com.ljsd.jieling.util.*;
|
import com.ljsd.jieling.util.*;
|
||||||
import config.*;
|
import config.*;
|
||||||
import manager.STableManager;
|
import manager.STableManager;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.redis.core.ZSetOperations;
|
|
||||||
import util.StringUtil;
|
import util.StringUtil;
|
||||||
import util.TimeUtils;
|
import util.TimeUtils;
|
||||||
|
|
||||||
|
|
@ -50,6 +46,7 @@ import java.util.*;
|
||||||
public class GuildLogic{
|
public class GuildLogic{
|
||||||
|
|
||||||
static GuildLogic guildLogicInstance = new GuildLogic();
|
static GuildLogic guildLogicInstance = new GuildLogic();
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(GuildLogic.class);
|
||||||
|
|
||||||
public GuildLogic() {
|
public GuildLogic() {
|
||||||
}
|
}
|
||||||
|
|
@ -129,8 +126,6 @@ public class GuildLogic{
|
||||||
MailLogic.getInstance().sendMail(user.getId(), title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
MailLogic.getInstance().sendMail(user.getId(), title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(GuildLogic.class);
|
|
||||||
|
|
||||||
public static int getMemberType(int targetUid, Map<Integer, Set<Integer>> members) {
|
public static int getMemberType(int targetUid, Map<Integer, Set<Integer>> members) {
|
||||||
for (Map.Entry<Integer, Set<Integer>> memberEntry : members.entrySet()) {
|
for (Map.Entry<Integer, Set<Integer>> memberEntry : members.entrySet()) {
|
||||||
Integer position = memberEntry.getKey();
|
Integer position = memberEntry.getKey();
|
||||||
|
|
@ -155,15 +150,28 @@ public class GuildLogic{
|
||||||
Family.GetFamilyInfoResponse.Builder builder = Family.GetFamilyInfoResponse.newBuilder()
|
Family.GetFamilyInfoResponse.Builder builder = Family.GetFamilyInfoResponse.newBuilder()
|
||||||
.setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo))
|
.setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo))
|
||||||
.setFamilyUserInfo(CBean2Proto.getFamilyUserInfo(user, getMemberType(uid, guildInfo.getMembers()))).setGuildBossId(GuildFightLogic.getCurSGuildBossConfig() == null ? 0 : GuildFightLogic.getCurSGuildBossConfig().getId());
|
.setFamilyUserInfo(CBean2Proto.getFamilyUserInfo(user, getMemberType(uid, guildInfo.getMembers()))).setGuildBossId(GuildFightLogic.getCurSGuildBossConfig() == null ? 0 : GuildFightLogic.getCurSGuildBossConfig().getId());
|
||||||
|
long now = TimeUtils.now();
|
||||||
|
long offlineTime = TimeUtils.ONE_DAY * 3;
|
||||||
for (Set<Integer> members : guildInfo.getMembers().values()) {
|
for (Set<Integer> members : guildInfo.getMembers().values()) {
|
||||||
for (int uidOfMember : members) {
|
for (int uidOfMember : members) {
|
||||||
|
try{
|
||||||
|
PlayerInfoCache userTmp = UserManager.getPlayerInfoCache(uidOfMember);
|
||||||
|
if (userTmp != null) {
|
||||||
|
long lastLoginTime = userTmp.getOffLineTime();
|
||||||
|
//离线超过3天,不发送信息
|
||||||
|
if((now - lastLoginTime) >= offlineTime){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
User userMember = UserManager.getUser(uidOfMember, true);
|
User userMember = UserManager.getUser(uidOfMember, true);
|
||||||
if(userMember != null) {
|
if(userMember != null) {
|
||||||
builder.addFamilyWalkIndicaiton(CBean2Proto.getFamilyWalkIndicaiton(userMember));
|
builder.addFamilyWalkIndicaiton(CBean2Proto.getFamilyWalkIndicaiton(userMember));
|
||||||
} else {
|
} else {
|
||||||
guildInfo.removeMember(guildInfo.getMemberType(user.getId()), user.getId());
|
guildInfo.removeMember(guildInfo.getMemberType(user.getId()), user.getId());
|
||||||
}
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
LOGGER.error("getFamilyInfo error uid:" + uidOfMember,e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (GuildFightLogic.carDelayProgressIndication != null) {
|
// if (GuildFightLogic.carDelayProgressIndication != null) {
|
||||||
|
|
@ -601,19 +609,19 @@ public class GuildLogic{
|
||||||
Family.GetFamilyMemberInfoResponse.Builder builder = Family.GetFamilyMemberInfoResponse.newBuilder();
|
Family.GetFamilyMemberInfoResponse.Builder builder = Family.GetFamilyMemberInfoResponse.newBuilder();
|
||||||
Map<Integer, Set<Integer>> members = guildInfo.getMembers();
|
Map<Integer, Set<Integer>> members = guildInfo.getMembers();
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
long offlineTime = TimeUtils.ONE_DAY * 3;
|
||||||
for (Map.Entry<Integer, Set<Integer>> memberEntry : members.entrySet()) {
|
for (Map.Entry<Integer, Set<Integer>> memberEntry : members.entrySet()) {
|
||||||
Integer position = memberEntry.getKey();
|
Integer position = memberEntry.getKey();
|
||||||
Set<Integer> value = memberEntry.getValue();
|
Set<Integer> value = memberEntry.getValue();
|
||||||
List<Integer> removes = new ArrayList<>();
|
List<Integer> removes = new ArrayList<>();
|
||||||
for (Integer uidTmp : value) {
|
for (Integer uidTmp : value) {
|
||||||
// LOGGER.info("uidTmp={}",uidTmp);
|
|
||||||
if(uidTmp != null) {
|
if(uidTmp != null) {
|
||||||
|
try{
|
||||||
User userTmp = UserManager.getUser(uidTmp, true);
|
User userTmp = UserManager.getUser(uidTmp, true);
|
||||||
// LOGGER.info("userTmp={}", userTmp);
|
|
||||||
if (userTmp != null) {
|
if (userTmp != null) {
|
||||||
long lastLoginTime = userTmp.getPlayerInfoManager().getLoginTime();
|
long lastLoginTime = userTmp.getPlayerInfoManager().getLoginTime();
|
||||||
//离线超过3天,且不是会长,踢出公会,并清除内存
|
//离线超过3天,且不是会长,踢出公会,并清除内存
|
||||||
if((now - lastLoginTime) >= TimeUtils.ONE_DAY * 3 && position != GlobalsDef.CHAIRMAN ){
|
if((now - lastLoginTime) >= offlineTime && position != GlobalsDef.CHAIRMAN ){
|
||||||
removes.add(uidTmp);
|
removes.add(uidTmp);
|
||||||
UserManager.removeUser(userTmp.getId());
|
UserManager.removeUser(userTmp.getId());
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -622,6 +630,9 @@ public class GuildLogic{
|
||||||
} else {
|
} else {
|
||||||
removes.add(uidTmp);
|
removes.add(uidTmp);
|
||||||
}
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
LOGGER.error("getGuildMemberInfo error with uid " + uidTmp,e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(removes.size() >0){
|
if(removes.size() >0){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue