|
|
@ -2,11 +2,11 @@ package com.bx.imserver.websocket.processor; |
|
|
|
|
|
|
|
|
import com.bx.imcommon.contant.RedisKey; |
|
|
import com.bx.imcommon.contant.RedisKey; |
|
|
import com.bx.imcommon.enums.IMCmdType; |
|
|
import com.bx.imcommon.enums.IMCmdType; |
|
|
import com.bx.imcommon.enums.SendResultType; |
|
|
import com.bx.imcommon.enums.IMSendStatus; |
|
|
import com.bx.imcommon.model.im.IMRecvInfo; |
|
|
import com.bx.imcommon.model.IMRecvInfo; |
|
|
import com.bx.imcommon.model.im.PrivateMessageInfo; |
|
|
import com.bx.imcommon.model.IMSendInfo; |
|
|
import com.bx.imcommon.model.im.SendInfo; |
|
|
import com.bx.imcommon.model.PrivateMessageInfo; |
|
|
import com.bx.imcommon.model.im.SendResult; |
|
|
import com.bx.imcommon.model.SendResult; |
|
|
import com.bx.imserver.websocket.WebsocketChannelCtxHolder; |
|
|
import com.bx.imserver.websocket.WebsocketChannelCtxHolder; |
|
|
import io.netty.channel.ChannelHandlerContext; |
|
|
import io.netty.channel.ChannelHandlerContext; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
@ -30,7 +30,7 @@ public class PrivateMessageProcessor extends MessageProcessor<IMRecvInfo<Privat |
|
|
ChannelHandlerContext channelCtx = WebsocketChannelCtxHolder.getChannelCtx(recvId); |
|
|
ChannelHandlerContext channelCtx = WebsocketChannelCtxHolder.getChannelCtx(recvId); |
|
|
if(channelCtx != null ){ |
|
|
if(channelCtx != null ){ |
|
|
// 推送消息到用户
|
|
|
// 推送消息到用户
|
|
|
SendInfo sendInfo = new SendInfo(); |
|
|
IMSendInfo sendInfo = new IMSendInfo(); |
|
|
sendInfo.setCmd(IMCmdType.PRIVATE_MESSAGE.getCode()); |
|
|
sendInfo.setCmd(IMCmdType.PRIVATE_MESSAGE.getCode()); |
|
|
sendInfo.setData(messageInfo); |
|
|
sendInfo.setData(messageInfo); |
|
|
channelCtx.channel().writeAndFlush(sendInfo); |
|
|
channelCtx.channel().writeAndFlush(sendInfo); |
|
|
@ -38,7 +38,7 @@ public class PrivateMessageProcessor extends MessageProcessor<IMRecvInfo<Privat |
|
|
String key = RedisKey.IM_RESULT_PRIVATE_QUEUE; |
|
|
String key = RedisKey.IM_RESULT_PRIVATE_QUEUE; |
|
|
SendResult sendResult = new SendResult(); |
|
|
SendResult sendResult = new SendResult(); |
|
|
sendResult.setRecvId(recvId); |
|
|
sendResult.setRecvId(recvId); |
|
|
sendResult.setResult(SendResultType.SUCCESS); |
|
|
sendResult.setStatus(IMSendStatus.SUCCESS); |
|
|
sendResult.setMessageInfo(messageInfo); |
|
|
sendResult.setMessageInfo(messageInfo); |
|
|
redisTemplate.opsForList().rightPush(key,sendResult); |
|
|
redisTemplate.opsForList().rightPush(key,sendResult); |
|
|
}else{ |
|
|
}else{ |
|
|
@ -46,7 +46,7 @@ public class PrivateMessageProcessor extends MessageProcessor<IMRecvInfo<Privat |
|
|
String key = RedisKey.IM_RESULT_PRIVATE_QUEUE; |
|
|
String key = RedisKey.IM_RESULT_PRIVATE_QUEUE; |
|
|
SendResult sendResult = new SendResult(); |
|
|
SendResult sendResult = new SendResult(); |
|
|
sendResult.setRecvId(recvId); |
|
|
sendResult.setRecvId(recvId); |
|
|
sendResult.setResult(SendResultType.FAIL); |
|
|
sendResult.setStatus(IMSendStatus.FAIL); |
|
|
sendResult.setFailReason("未找到WS连接"); |
|
|
sendResult.setFailReason("未找到WS连接"); |
|
|
sendResult.setMessageInfo(messageInfo); |
|
|
sendResult.setMessageInfo(messageInfo); |
|
|
redisTemplate.opsForList().rightPush(key,sendResult); |
|
|
redisTemplate.opsForList().rightPush(key,sendResult); |
|
|
@ -57,7 +57,7 @@ public class PrivateMessageProcessor extends MessageProcessor<IMRecvInfo<Privat |
|
|
String key = RedisKey.IM_RESULT_PRIVATE_QUEUE; |
|
|
String key = RedisKey.IM_RESULT_PRIVATE_QUEUE; |
|
|
SendResult sendResult = new SendResult(); |
|
|
SendResult sendResult = new SendResult(); |
|
|
sendResult.setRecvId(recvId); |
|
|
sendResult.setRecvId(recvId); |
|
|
sendResult.setResult(SendResultType.FAIL); |
|
|
sendResult.setStatus(IMSendStatus.FAIL); |
|
|
sendResult.setFailReason("未知异常"); |
|
|
sendResult.setFailReason("未知异常"); |
|
|
sendResult.setMessageInfo(messageInfo); |
|
|
sendResult.setMessageInfo(messageInfo); |
|
|
redisTemplate.opsForList().rightPush(key,sendResult); |
|
|
redisTemplate.opsForList().rightPush(key,sendResult); |
|
|
|