mirror of
https://github.com/zongzibinbin/MallChat.git
synced 2026-03-15 15:13:43 +08:00
fix:
1.翻页条数限制失败bug 2.消息标记的事务方法重写失效问题
This commit is contained in:
@@ -44,13 +44,13 @@ public class ChatController {
|
||||
|
||||
@GetMapping("/public/room/page")
|
||||
@ApiOperation("会话列表")
|
||||
public ApiResult<CursorPageBaseResp<ChatRoomResp>> getRoomPage(CursorPageBaseReq request) {
|
||||
public ApiResult<CursorPageBaseResp<ChatRoomResp>> getRoomPage(@Valid CursorPageBaseReq request) {
|
||||
return ApiResult.success(chatService.getRoomPage(request, RequestHolder.get().getUid()));
|
||||
}
|
||||
|
||||
@GetMapping("/public/member/page")
|
||||
@ApiOperation("群成员列表")
|
||||
public ApiResult<CursorPageBaseResp<ChatMemberResp>> getMemberPage(CursorPageBaseReq request) {
|
||||
public ApiResult<CursorPageBaseResp<ChatMemberResp>> getMemberPage(@Valid CursorPageBaseReq request) {
|
||||
CursorPageBaseResp<ChatMemberResp> memberPage = chatService.getMemberPage(request);
|
||||
filterBlackMember(memberPage);
|
||||
return ApiResult.success(memberPage);
|
||||
@@ -72,7 +72,7 @@ public class ChatController {
|
||||
|
||||
@GetMapping("/public/msg/page")
|
||||
@ApiOperation("消息列表")
|
||||
public ApiResult<CursorPageBaseResp<ChatMessageResp>> getMsgPage(ChatMessagePageReq request) {
|
||||
public ApiResult<CursorPageBaseResp<ChatMessageResp>> getMsgPage(@Valid ChatMessagePageReq request) {
|
||||
CursorPageBaseResp<ChatMessageResp> msgPage = chatService.getMsgPage(request, RequestHolder.get().getUid());
|
||||
filterBlackMsg(msgPage);
|
||||
return ApiResult.success(msgPage);
|
||||
|
||||
@@ -31,12 +31,12 @@ public abstract class AbstractMsgMarkStrategy {
|
||||
|
||||
@Transactional
|
||||
public void mark(Long uid, Long msgId) {
|
||||
exec(uid, msgId, MessageMarkActTypeEnum.MARK);
|
||||
doMark(uid, msgId);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void unMark(Long uid, Long msgId) {
|
||||
exec(uid, msgId, MessageMarkActTypeEnum.UN_MARK);
|
||||
doUnMark(uid, msgId);
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
@@ -44,6 +44,14 @@ public abstract class AbstractMsgMarkStrategy {
|
||||
MsgMarkFactory.register(getTypeEnum().getType(), this);
|
||||
}
|
||||
|
||||
protected void doMark(Long uid, Long msgId) {
|
||||
exec(uid, msgId, MessageMarkActTypeEnum.MARK);
|
||||
}
|
||||
|
||||
protected void doUnMark(Long uid, Long msgId) {
|
||||
exec(uid, msgId, MessageMarkActTypeEnum.UN_MARK);
|
||||
}
|
||||
|
||||
protected void exec(Long uid, Long msgId, MessageMarkActTypeEnum actTypeEnum) {
|
||||
Integer markType = getTypeEnum().getType();
|
||||
Integer actType = actTypeEnum.getType();
|
||||
|
||||
@@ -22,7 +22,7 @@ public class DisLikeStrategy extends AbstractMsgMarkStrategy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mark(Long uid, Long msgId) {
|
||||
public void doMark(Long uid, Long msgId) {
|
||||
super.mark(uid, msgId);
|
||||
//同时取消点赞的动作
|
||||
MsgMarkFactory.getStrategyNoNull(MessageMarkTypeEnum.LIKE.getType()).unMark(uid, msgId);
|
||||
|
||||
@@ -17,7 +17,7 @@ public class LikeStrategy extends AbstractMsgMarkStrategy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mark(Long uid, Long msgId) {
|
||||
public void doMark(Long uid, Long msgId) {
|
||||
super.mark(uid, msgId);
|
||||
//同时取消点踩的动作
|
||||
MsgMarkFactory.getStrategyNoNull(MessageMarkTypeEnum.DISLIKE.getType()).unMark(uid, msgId);
|
||||
|
||||
@@ -14,6 +14,7 @@ import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
|
||||
import io.netty.handler.logging.LogLevel;
|
||||
import io.netty.handler.logging.LoggingHandler;
|
||||
import io.netty.handler.stream.ChunkedWriteHandler;
|
||||
import io.netty.handler.timeout.IdleStateHandler;
|
||||
import io.netty.util.concurrent.Future;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -65,7 +66,7 @@ public class NettyWebSocketServer {
|
||||
protected void initChannel(SocketChannel socketChannel) throws Exception {
|
||||
ChannelPipeline pipeline = socketChannel.pipeline();
|
||||
//30秒客户端没有向服务器发送心跳则关闭连接
|
||||
// pipeline.addLast(new IdleStateHandler(30, 0, 0));
|
||||
pipeline.addLast(new IdleStateHandler(30, 0, 0));
|
||||
// 因为使用http协议,所以需要使用http的编码器,解码器
|
||||
pipeline.addLast(new HttpServerCodec());
|
||||
// 以块方式写,添加 chunkedWriter 处理器
|
||||
|
||||
Reference in New Issue
Block a user