chat
parent
8e87514b8f
commit
730bafb538
|
@ -11,9 +11,11 @@ import com.ljsd.jieling.db.redis.RedisKey;
|
||||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
import com.ljsd.jieling.logic.dao.FriendManager;
|
import com.ljsd.jieling.logic.dao.FriendManager;
|
||||||
|
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
import com.ljsd.jieling.logic.dao.root.User;
|
||||||
|
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
import com.ljsd.jieling.protocols.ChatProto;
|
import com.ljsd.jieling.protocols.ChatProto;
|
||||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||||
|
@ -53,9 +55,6 @@ public class ChatLogic {
|
||||||
case 1: //世界
|
case 1: //世界
|
||||||
chatInfoList = MessageCache.worldMsg.getObjs(messageId);
|
chatInfoList = MessageCache.worldMsg.getObjs(messageId);
|
||||||
break;
|
break;
|
||||||
case 2: //公会
|
|
||||||
chatInfoList = MessageCache.guildMsg.getObjs(messageId);
|
|
||||||
break;
|
|
||||||
case 3: //好友
|
case 3: //好友
|
||||||
Map<Object, Object> hmget = RedisUtil.getInstence().hmget(GameApplication.serverId + RedisKey.CUser_Chat + uid);
|
Map<Object, Object> hmget = RedisUtil.getInstence().hmget(GameApplication.serverId + RedisKey.CUser_Chat + uid);
|
||||||
if (hmget != null && hmget.size() != 0){
|
if (hmget != null && hmget.size() != 0){
|
||||||
|
@ -142,9 +141,16 @@ public class ChatLogic {
|
||||||
MessageCache.addWordMsg(chatInfo,messageId);
|
MessageCache.addWordMsg(chatInfo,messageId);
|
||||||
break;
|
break;
|
||||||
case 2: //公会
|
case 2: //公会
|
||||||
messageId = RedisUtil.getInstence().increment(GameApplication.serverId + RedisKey.CHAT_GUILD_MSG_ID+ GameApplication.serverId);
|
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||||
chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,messageId);
|
if(guildId==0){
|
||||||
MessageCache.addGuildMsg(chatInfo,messageId);
|
MessageUtil.sendErrorResponse(iSession,0, msgId, "未加入公会");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,0);
|
||||||
|
ChatProto.SendChatInfoIndication sendChatInfoIndication = ChatProto.SendChatInfoIndication.newBuilder()
|
||||||
|
.setChatInfo(chatInfo)
|
||||||
|
.build();
|
||||||
|
GuildLogic.sendIndicationToMember(GuilidManager.guildInfoMap.get(guildId),MessageTypeProto.MessageType.SEND_CHAT_INFO_INDICATION,sendChatInfoIndication);
|
||||||
break;
|
break;
|
||||||
case 3: //好友
|
case 3: //好友
|
||||||
List<Integer> friends = friendManager.getFriends();
|
List<Integer> friends = friendManager.getFriends();
|
||||||
|
@ -156,7 +162,7 @@ public class ChatLogic {
|
||||||
if (OnlineUserManager.checkUidOnline(friendId)){
|
if (OnlineUserManager.checkUidOnline(friendId)){
|
||||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(friendId);
|
ISession sessionByUid = OnlineUserManager.getSessionByUid(friendId);
|
||||||
chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,0);
|
chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,0);
|
||||||
ChatProto.SendChatInfoIndication sendChatInfoIndication = ChatProto.SendChatInfoIndication.newBuilder()
|
sendChatInfoIndication = ChatProto.SendChatInfoIndication.newBuilder()
|
||||||
.setChatInfo(chatInfo)
|
.setChatInfo(chatInfo)
|
||||||
.build();
|
.build();
|
||||||
assert sessionByUid != null;
|
assert sessionByUid != null;
|
||||||
|
|
|
@ -9,7 +9,6 @@ public class MessageCache {
|
||||||
|
|
||||||
public static LoopQueue worldMsg = new LoopQueue(capuatiy,perCaught,msgInterval);
|
public static LoopQueue worldMsg = new LoopQueue(capuatiy,perCaught,msgInterval);
|
||||||
public static LoopQueue sysMsg = new LoopQueue(capuatiy,perCaught,msgInterval);
|
public static LoopQueue sysMsg = new LoopQueue(capuatiy,perCaught,msgInterval);
|
||||||
public static LoopQueue guildMsg = new LoopQueue(capuatiy,perCaught,msgInterval);
|
|
||||||
|
|
||||||
|
|
||||||
public static void addWordMsg(ChatProto.ChatInfo chatInfo,long messageId){
|
public static void addWordMsg(ChatProto.ChatInfo chatInfo,long messageId){
|
||||||
|
@ -20,7 +19,4 @@ public class MessageCache {
|
||||||
sysMsg.push(chatInfo,messageId);
|
sysMsg.push(chatInfo,messageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addGuildMsg(ChatProto.ChatInfo chatInfo,long messageId ){
|
|
||||||
guildMsg.push(chatInfo,messageId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue