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:
bujinyuan
2026-03-04 14:58:23 +08:00
parent ad76d9a613
commit 19979da59e
77 changed files with 10053 additions and 490 deletions

View File

@@ -1,20 +1,25 @@
package model
import "time"
import (
"time"
"github.com/echochat/backend/pkg/utils"
)
// Message 消息模型,对应 im_messages 表
// Type: 1=文本(预留 2=图片 3=语音 4=视频 5=文件)
// Type: 1=文本(预留 2=图片 3=语音 4=视频 5=文件)10=系统消息
// Status: 1=正常 2=已撤回 3=已删除
type Message struct {
ID int64 `json:"id" gorm:"primaryKey;autoIncrement"` // 消息唯一标识,自增主键
ConversationID int64 `json:"conversation_id" gorm:"not null;index:idx_msg_conv_time;index:idx_msg_conv_id"` // 所属会话 ID
SenderID int64 `json:"sender_id" gorm:"not null"` // 发送者用户 ID
Type int `json:"type" gorm:"not null;default:1"` // 消息类型1=文本(预留扩展)
Content string `json:"content" gorm:"type:text;not null"` // 消息内容
Extra *string `json:"extra" gorm:"type:jsonb"` // 扩展数据JSON 格式,预留图片/语音等元信息)
Status int `json:"status" gorm:"not null;default:1"` // 消息状态1=正常2=已撤回3=已删除
ClientMsgID string `json:"client_msg_id" gorm:"size:64;default:''"` // 客户端消息唯一 ID用于幂等去重
CreatedAt time.Time `json:"created_at" gorm:"not null;autoCreateTime;type:timestamp(0)"` // 消息发送时间
ID int64 `json:"id" gorm:"primaryKey;autoIncrement"` // 消息唯一标识,自增主键
ConversationID int64 `json:"conversation_id" gorm:"not null;index:idx_msg_conv_time;index:idx_msg_conv_id"` // 所属会话 ID
SenderID int64 `json:"sender_id" gorm:"not null"` // 发送者用户 ID(系统消息为 0
Type int `json:"type" gorm:"not null;default:1"` // 消息类型1=文本10=系统消息
Content string `json:"content" gorm:"type:text;not null"` // 消息内容
Extra *string `json:"extra" gorm:"type:jsonb"` // 扩展数据JSON 格式,预留图片/语音等元信息)
Status int `json:"status" gorm:"not null;default:1"` // 消息状态1=正常2=已撤回3=已删除
ClientMsgID string `json:"client_msg_id" gorm:"size:64;default:''"` // 客户端消息唯一 ID用于幂等去重
AtUserIDs utils.Int64Array `json:"at_user_ids" gorm:"type:bigint[]"` // @提醒用户 ID 列表nil=无@,含 0 表示 @所有人
CreatedAt time.Time `json:"created_at" gorm:"not null;autoCreateTime;type:timestamp(0)"` // 消息发送时间
}
// TableName 指定数据库表名