back_recharge
wangyuan 2019-09-23 18:02:39 +08:00
parent 8e87514b8f
commit 730bafb538
2 changed files with 13 additions and 11 deletions

View File

@ -11,9 +11,11 @@ import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.logic.OnlineUserManager;
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.UserManager;
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.protocols.ChatProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
@ -53,9 +55,6 @@ public class ChatLogic {
case 1: //世界
chatInfoList = MessageCache.worldMsg.getObjs(messageId);
break;
case 2: //公会
chatInfoList = MessageCache.guildMsg.getObjs(messageId);
break;
case 3: //好友
Map<Object, Object> hmget = RedisUtil.getInstence().hmget(GameApplication.serverId + RedisKey.CUser_Chat + uid);
if (hmget != null && hmget.size() != 0){
@ -142,9 +141,16 @@ public class ChatLogic {
MessageCache.addWordMsg(chatInfo,messageId);
break;
case 2: //公会
messageId = RedisUtil.getInstence().increment(GameApplication.serverId + RedisKey.CHAT_GUILD_MSG_ID+ GameApplication.serverId);
chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,messageId);
MessageCache.addGuildMsg(chatInfo,messageId);
int guildId = user.getPlayerInfoManager().getGuildId();
if(guildId==0){
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;
case 3: //好友
List<Integer> friends = friendManager.getFriends();
@ -156,7 +162,7 @@ public class ChatLogic {
if (OnlineUserManager.checkUidOnline(friendId)){
ISession sessionByUid = OnlineUserManager.getSessionByUid(friendId);
chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,0);
ChatProto.SendChatInfoIndication sendChatInfoIndication = ChatProto.SendChatInfoIndication.newBuilder()
sendChatInfoIndication = ChatProto.SendChatInfoIndication.newBuilder()
.setChatInfo(chatInfo)
.build();
assert sessionByUid != null;

View File

@ -9,7 +9,6 @@ public class MessageCache {
public static LoopQueue worldMsg = 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){
@ -20,7 +19,4 @@ public class MessageCache {
sysMsg.push(chatInfo,messageId);
}
public static void addGuildMsg(ChatProto.ChatInfo chatInfo,long messageId ){
guildMsg.push(chatInfo,messageId);
}
}