Skip to content

06. 后端参考

1. 数据库表结构

1.1 用户会话表 (chat_user_conversation)

字段类型说明
user_idVARCHAR用户ID
conversation_idVARCHAR对方ID/群ID
is_pinnedTINYINT是否置顶
unread_countINT未读消息数

1.2 聊天消息表 (chat_message)

字段类型说明
sender_idVARCHAR发送者
contentTEXT内容
statusVARCHAR状态 (normal/recall)

2. 后端架构说明

  • 技术栈:Spring Boot 3.x, WebSocket, Redis, MyBatis-Plus, JDK 21 (虚拟线程)。
  • 消息流转
    1. SocketHandler 接收原始消息。
    2. MessageService 处理持久化与逻辑。
    3. WebSocketUtil 通过 synchronized 锁确保并发发送安全。

Released under the MIT License.