feat:聊天信息支持 文件、图片、语音发送,增加一键启停脚本
This commit is contained in:
@@ -59,3 +59,84 @@ type AdminCreateUserRequest struct {
|
||||
Nickname string `json:"nickname" binding:"max=50"` // 昵称(选填)
|
||||
RoleCode string `json:"role_code" binding:"omitempty"` // 初始角色(选填,默认 user)
|
||||
}
|
||||
|
||||
// ====== 管理端消息管理 DTO ======
|
||||
|
||||
// AdminMessageListRequest 管理端消息列表查询请求
|
||||
type AdminMessageListRequest struct {
|
||||
Keyword string `form:"keyword"` // 搜索关键词(模糊匹配消息内容)
|
||||
Type *int `form:"type"` // 消息类型筛选(1/2/3/5/10)
|
||||
SenderID *int64 `form:"sender_id"` // 发送者 ID
|
||||
ConversationID *int64 `form:"conversation_id"` // 会话 ID
|
||||
Status *int `form:"status"` // 消息状态(1=正常/2=已撤回/3=已删除)
|
||||
StartTime string `form:"start_time"` // 开始时间(YYYY-MM-DD)
|
||||
EndTime string `form:"end_time"` // 结束时间(YYYY-MM-DD)
|
||||
Page int `form:"page"` // 页码(默认1)
|
||||
PageSize int `form:"page_size"` // 每页条数(默认20)
|
||||
}
|
||||
|
||||
// AdminMessageListResponse 管理端消息列表响应
|
||||
type AdminMessageListResponse struct {
|
||||
Total int64 `json:"total"` // 总条数
|
||||
List []AdminMessageDTO `json:"list"` // 消息列表
|
||||
Page int `json:"page"` // 当前页码
|
||||
PageSize int `json:"page_size"` // 每页条数
|
||||
}
|
||||
|
||||
// AdminMessageDTO 管理端消息条目
|
||||
type AdminMessageDTO struct {
|
||||
ID int64 `json:"id"` // 消息 ID
|
||||
ConversationID int64 `json:"conversation_id"` // 会话 ID
|
||||
SenderID int64 `json:"sender_id"` // 发送者 ID
|
||||
SenderNickname string `json:"sender_nickname"` // 发送者昵称
|
||||
SenderAvatar string `json:"sender_avatar"` // 发送者头像
|
||||
Type int `json:"type"` // 消息类型
|
||||
TypeLabel string `json:"type_label"` // 类型中文标签
|
||||
Content string `json:"content"` // 消息内容
|
||||
Extra *string `json:"extra,omitempty"` // 扩展数据 JSON
|
||||
Status int `json:"status"` // 消息状态
|
||||
StatusLabel string `json:"status_label"` // 状态中文标签
|
||||
CreatedAt string `json:"created_at"` // 发送时间
|
||||
}
|
||||
|
||||
// AdminMessageStatsRequest 管理端消息统计请求
|
||||
type AdminMessageStatsRequest struct {
|
||||
Days int `form:"days"` // 统计天数(默认7,最大90)
|
||||
}
|
||||
|
||||
// AdminMessageStatsResponse 管理端消息统计响应
|
||||
type AdminMessageStatsResponse struct {
|
||||
TotalCount int64 `json:"total_count"` // 消息总数
|
||||
TodayCount int64 `json:"today_count"` // 今日消息数
|
||||
TypeDistribution []TypeDistItem `json:"type_distribution"` // 类型分布
|
||||
DailyTrend []DailyTrendItem `json:"daily_trend"` // 每日趋势
|
||||
ActiveUsers []ActiveUserItem `json:"active_users"` // 活跃用户排行
|
||||
ActiveGroups []ActiveGroupItem `json:"active_groups"` // 活跃群组排行
|
||||
}
|
||||
|
||||
// TypeDistItem 消息类型分布条目
|
||||
type TypeDistItem struct {
|
||||
Type int `json:"type"` // 消息类型
|
||||
Label string `json:"label"` // 类型中文标签
|
||||
Count int64 `json:"count"` // 数量
|
||||
}
|
||||
|
||||
// DailyTrendItem 每日消息趋势条目
|
||||
type DailyTrendItem struct {
|
||||
Date string `json:"date"` // 日期(YYYY-MM-DD)
|
||||
Count int64 `json:"count"` // 数量
|
||||
}
|
||||
|
||||
// ActiveUserItem 活跃用户排行条目
|
||||
type ActiveUserItem struct {
|
||||
UserID int64 `json:"user_id"` // 用户 ID
|
||||
Nickname string `json:"nickname"` // 昵称
|
||||
Count int64 `json:"count"` // 消息数
|
||||
}
|
||||
|
||||
// ActiveGroupItem 活跃群组排行条目
|
||||
type ActiveGroupItem struct {
|
||||
GroupID int64 `json:"group_id"` // 群组 ID
|
||||
Name string `json:"name"` // 群名称
|
||||
Count int64 `json:"count"` // 消息数
|
||||
}
|
||||
|
||||
@@ -6,23 +6,25 @@ package dto
|
||||
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"` // 消息内容
|
||||
Type int `json:"type"` // 消息类型:1=文本, 2=图片, 3=语音, 5=文件
|
||||
Content string `json:"content"` // 消息内容(富媒体消息时为空字符串)
|
||||
Extra string `json:"extra"` // 扩展数据 JSON 字符串(图片/语音/文件元信息)
|
||||
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
|
||||
AtUserIDs []int64 `json:"at_user_ids"` // @提醒用户 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"` // 消息内容
|
||||
Extra *string `json:"extra,omitempty"` // 扩展数据 JSON(图片/语音/文件元信息)
|
||||
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 字段)
|
||||
|
||||
Reference in New Issue
Block a user