feat(phase2c): 群聊与已读回执功能完整实现
Phase 2c 全部 14 个 Task 完成,包含: 后端(Go): - MinIO 文件存储服务集成(Docker + Go SDK + 通用上传 API) - Group 模块完整实现(DAO + Service + Controller + Router + Wire) - 18 个群管理 REST API + 11 个 WS 群事件推送 - 群创建/解散/邀请/踢人/退出/转让群主/设管理员/禁言/全体禁言/群公告/群昵称/免打扰/搜索 - IM Service 扩展(群消息发送/撤回 + @提醒 + 管理员无时限撤回) - 已读回执后端(单聊会话级 last_read_msg_id + 群聊消息级 im_message_reads) - 管理端群组管理(列表/详情/解散) - 数据库迁移(3 张新表 + 2 张表字段扩展) 前端(uni-app): - 群聊 Store + API 封装 + 11 个 WS 事件监听 - 已读回执 UI(单聊已读/未读标记 + 群聊 X人已读 + 已读详情页) - 7 个群聊页面(对话/创建/设置/成员/邀请/审批/搜索) - 会话列表改造(全部/单聊/群聊 Tab + @标记 + 免打扰标识) 管理端(Vue 3 + Element Plus): - 群组列表页(搜索/分页/详情弹窗/解散群聊) - 侧边栏群组管理入口 文档同步:进度/架构/设计/API/规范文档全部更新 Made-with: Cursor
This commit is contained in:
@@ -4,23 +4,25 @@ package dto
|
||||
|
||||
// SendMessageRequest 发送消息请求(WS 事件 im.message.send 的 data 字段)
|
||||
type SendMessageRequest struct {
|
||||
ConversationID int64 `json:"conversation_id"` // 会话 ID(与 TargetUserID 二选一)
|
||||
TargetUserID int64 `json:"target_user_id"` // 对方用户 ID(首次发消息时使用,自动创建会话)
|
||||
Type int `json:"type"` // 消息类型:1=文本
|
||||
Content string `json:"content"` // 消息内容
|
||||
ClientMsgID string `json:"client_msg_id"` // 客户端消息唯一 ID,用于幂等去重
|
||||
ConversationID int64 `json:"conversation_id"` // 会话 ID(与 TargetUserID 二选一)
|
||||
TargetUserID int64 `json:"target_user_id"` // 对方用户 ID(首次发消息时使用,自动创建会话)
|
||||
Type int `json:"type"` // 消息类型:1=文本
|
||||
Content string `json:"content"` // 消息内容
|
||||
ClientMsgID string `json:"client_msg_id"` // 客户端消息唯一 ID,用于幂等去重
|
||||
AtUserIDs []int64 `json:"at_user_ids"` // @提醒用户 ID 列表(含 0 表示 @所有人)
|
||||
}
|
||||
|
||||
// MessageDTO 消息传输对象(返回给前端)
|
||||
type MessageDTO struct {
|
||||
ID int64 `json:"id"` // 消息 ID
|
||||
ConversationID int64 `json:"conversation_id"` // 所属会话 ID
|
||||
SenderID int64 `json:"sender_id"` // 发送者用户 ID
|
||||
Type int `json:"type"` // 消息类型
|
||||
Content string `json:"content"` // 消息内容
|
||||
Status int `json:"status"` // 消息状态:1=正常,2=已撤回
|
||||
ClientMsgID string `json:"client_msg_id"` // 客户端消息 ID
|
||||
CreatedAt string `json:"created_at"` // 发送时间
|
||||
ID int64 `json:"id"` // 消息 ID
|
||||
ConversationID int64 `json:"conversation_id"` // 所属会话 ID
|
||||
SenderID int64 `json:"sender_id"` // 发送者用户 ID
|
||||
Type int `json:"type"` // 消息类型
|
||||
Content string `json:"content"` // 消息内容
|
||||
Status int `json:"status"` // 消息状态:1=正常,2=已撤回
|
||||
ClientMsgID string `json:"client_msg_id"` // 客户端消息 ID
|
||||
AtUserIDs []int64 `json:"at_user_ids"` // @提醒用户 ID 列表
|
||||
CreatedAt string `json:"created_at"` // 发送时间
|
||||
}
|
||||
|
||||
// RecallMessageRequest 撤回消息请求(WS 事件 im.message.recall 的 data 字段)
|
||||
@@ -32,16 +34,19 @@ type RecallMessageRequest struct {
|
||||
|
||||
// ConversationDTO 会话列表条目(返回给前端)
|
||||
type ConversationDTO struct {
|
||||
ID int64 `json:"id"` // 会话 ID
|
||||
Type int `json:"type"` // 会话类型:1=单聊
|
||||
PeerUserID int64 `json:"peer_user_id"` // 单聊对方用户 ID
|
||||
PeerNickname string `json:"peer_nickname"` // 对方昵称
|
||||
PeerAvatar string `json:"peer_avatar"` // 对方头像
|
||||
LastMsgContent string `json:"last_msg_content"` // 最后消息预览
|
||||
LastMsgTime string `json:"last_msg_time"` // 最后消息时间
|
||||
ID int64 `json:"id"` // 会话 ID
|
||||
Type int `json:"type"` // 会话类型:1=单聊,2=群聊
|
||||
PeerUserID int64 `json:"peer_user_id"` // 单聊对方用户 ID(群聊为 0)
|
||||
PeerNickname string `json:"peer_nickname"` // 对方昵称(群聊时为群名称)
|
||||
PeerAvatar string `json:"peer_avatar"` // 对方头像(群聊时为群头像)
|
||||
LastMsgContent string `json:"last_msg_content"` // 最后消息预览
|
||||
LastMsgTime string `json:"last_msg_time"` // 最后消息时间
|
||||
LastMsgSenderID *int64 `json:"last_msg_sender_id"` // 最后消息发送者 ID
|
||||
IsPinned bool `json:"is_pinned"` // 是否置顶
|
||||
UnreadCount int `json:"unread_count"` // 未读消息数
|
||||
IsPinned bool `json:"is_pinned"` // 是否置顶
|
||||
UnreadCount int `json:"unread_count"` // 未读消息数
|
||||
GroupID int64 `json:"group_id,omitempty"` // 群聊 ID(仅 type=2 有值)
|
||||
IsDoNotDisturb bool `json:"is_do_not_disturb"` // 是否免打扰
|
||||
AtMeCount int `json:"at_me_count"` // 被@提醒未读计数
|
||||
}
|
||||
|
||||
// ConversationListResponse 会话列表响应
|
||||
|
||||
Reference in New Issue
Block a user