好友聊天在线好友推送
parent
da4b5a36d3
commit
ebb8c6341c
|
@ -5,6 +5,7 @@ import com.ljsd.GameApplication;
|
||||||
import com.ljsd.jieling.chat.messge.MessageCache;
|
import com.ljsd.jieling.chat.messge.MessageCache;
|
||||||
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;
|
||||||
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
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.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
@ -57,6 +58,8 @@ public class ChatLogic {
|
||||||
CBean2Proto.getChatInfoBuilder(user,message,time);
|
CBean2Proto.getChatInfoBuilder(user,message,time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//取出数据好友聊天数据后删除
|
||||||
|
RedisUtil.getInstence().hdel(GameApplication.serverId + RedisKey.CUser_Chat + uid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ChatProto.GetChatMessageInfoResponse getChatMessageInfoResponse = ChatProto.GetChatMessageInfoResponse
|
ChatProto.GetChatMessageInfoResponse getChatMessageInfoResponse = ChatProto.GetChatMessageInfoResponse
|
||||||
|
@ -85,7 +88,18 @@ public class ChatLogic {
|
||||||
MessageCache.addGuildMsg(chatInfo);
|
MessageCache.addGuildMsg(chatInfo);
|
||||||
break;
|
break;
|
||||||
case 3: //好友
|
case 3: //好友
|
||||||
RedisUtil.getInstence().hset(GameApplication.serverId +RedisKey.CUser_Chat+friendId,uid +"#"+ nowTime,message, -1);
|
//现在好友推送
|
||||||
|
if (OnlineUserManager.checkUidOnline(friendId)){
|
||||||
|
ISession sessionByUid = OnlineUserManager.getSessionByUid(friendId);
|
||||||
|
chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime);
|
||||||
|
ChatProto.SendChatInfoIndication sendChatInfoIndication = ChatProto.SendChatInfoIndication.newBuilder()
|
||||||
|
.setChatInfo(chatInfo)
|
||||||
|
.build();
|
||||||
|
assert sessionByUid != null;
|
||||||
|
MessageUtil.sendMessage(sessionByUid, 1, MessageTypeProto.MessageType.SEND_FRIEND_INFO_INDICATION_VALUE, sendChatInfoIndication, true);
|
||||||
|
}else{
|
||||||
|
RedisUtil.getInstence().hset(GameApplication.serverId +RedisKey.CUser_Chat+friendId,uid +"#"+ nowTime,message, -1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.SEND_CHAT_INFO_RESPONSE_VALUE, null, true);
|
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.SEND_CHAT_INFO_RESPONSE_VALUE, null, true);
|
||||||
|
|
Loading…
Reference in New Issue