2026-04-23 22:29:34 +08:00
|
|
|
|
package dto
|
2026-03-09 21:28:58 +08:00
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"time"
|
2026-04-23 22:29:34 +08:00
|
|
|
|
"with_you/internal/model"
|
2026-03-09 21:28:58 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== User DTOs ====================
|
|
|
|
|
|
|
2026-03-19 13:49:51 +08:00
|
|
|
|
// UserResponse 用户公开信息响应(不包含敏感信息)
|
2026-03-09 21:28:58 +08:00
|
|
|
|
type UserResponse struct {
|
2026-03-19 13:49:51 +08:00
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Username string `json:"username"`
|
|
|
|
|
|
Nickname string `json:"nickname"`
|
|
|
|
|
|
EmailVerified bool `json:"email_verified"`
|
|
|
|
|
|
Avatar string `json:"avatar"`
|
|
|
|
|
|
CoverURL string `json:"cover_url"`
|
|
|
|
|
|
Bio string `json:"bio"`
|
|
|
|
|
|
Website string `json:"website"`
|
|
|
|
|
|
Location string `json:"location"`
|
|
|
|
|
|
PostsCount int `json:"posts_count"`
|
|
|
|
|
|
FollowersCount int `json:"followers_count"`
|
|
|
|
|
|
FollowingCount int `json:"following_count"`
|
|
|
|
|
|
IsFollowing bool `json:"is_following"`
|
|
|
|
|
|
IsFollowingMe bool `json:"is_following_me"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UserSelfResponse 用户自身信息响应(包含敏感信息,仅本人可见)
|
|
|
|
|
|
type UserSelfResponse struct {
|
2026-03-09 21:28:58 +08:00
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Username string `json:"username"`
|
|
|
|
|
|
Nickname string `json:"nickname"`
|
|
|
|
|
|
Email *string `json:"email,omitempty"`
|
|
|
|
|
|
Phone *string `json:"phone,omitempty"`
|
|
|
|
|
|
EmailVerified bool `json:"email_verified"`
|
|
|
|
|
|
Avatar string `json:"avatar"`
|
2026-03-19 13:49:51 +08:00
|
|
|
|
CoverURL string `json:"cover_url"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
Bio string `json:"bio"`
|
|
|
|
|
|
Website string `json:"website"`
|
|
|
|
|
|
Location string `json:"location"`
|
|
|
|
|
|
PostsCount int `json:"posts_count"`
|
|
|
|
|
|
FollowersCount int `json:"followers_count"`
|
|
|
|
|
|
FollowingCount int `json:"following_count"`
|
2026-03-19 13:49:51 +08:00
|
|
|
|
IsVerified bool `json:"is_verified"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
CreatedAt string `json:"created_at"`
|
2026-04-08 14:55:50 +08:00
|
|
|
|
// 隐私设置
|
|
|
|
|
|
PrivacySettings *PrivacySettingsResponse `json:"privacy_settings,omitempty"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-19 13:49:51 +08:00
|
|
|
|
// UserDetailResponse 用户详情响应(仅本人可见,包含敏感信息)
|
2026-03-09 21:28:58 +08:00
|
|
|
|
type UserDetailResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Username string `json:"username"`
|
|
|
|
|
|
Nickname string `json:"nickname"`
|
2026-03-19 13:49:51 +08:00
|
|
|
|
Email *string `json:"email,omitempty"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
EmailVerified bool `json:"email_verified"`
|
2026-03-19 13:49:51 +08:00
|
|
|
|
Phone *string `json:"phone,omitempty"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
Avatar string `json:"avatar"`
|
2026-03-19 13:49:51 +08:00
|
|
|
|
CoverURL string `json:"cover_url"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
Bio string `json:"bio"`
|
|
|
|
|
|
Website string `json:"website"`
|
|
|
|
|
|
Location string `json:"location"`
|
|
|
|
|
|
PostsCount int `json:"posts_count"`
|
|
|
|
|
|
FollowersCount int `json:"followers_count"`
|
|
|
|
|
|
FollowingCount int `json:"following_count"`
|
|
|
|
|
|
IsVerified bool `json:"is_verified"`
|
2026-03-19 13:49:51 +08:00
|
|
|
|
IsFollowing bool `json:"is_following"`
|
|
|
|
|
|
IsFollowingMe bool `json:"is_following_me"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
CreatedAt string `json:"created_at"`
|
2026-04-08 14:55:50 +08:00
|
|
|
|
// 隐私设置
|
|
|
|
|
|
PrivacySettings *PrivacySettingsResponse `json:"privacy_settings,omitempty"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-14 18:01:55 +08:00
|
|
|
|
// ==================== Admin User DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// AdminUserListResponse 管理端用户列表响应
|
|
|
|
|
|
type AdminUserListResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Username string `json:"username"`
|
|
|
|
|
|
Nickname string `json:"nickname"`
|
|
|
|
|
|
Email *string `json:"email,omitempty"`
|
|
|
|
|
|
Phone *string `json:"phone,omitempty"`
|
|
|
|
|
|
EmailVerified bool `json:"email_verified"`
|
|
|
|
|
|
Avatar string `json:"avatar"`
|
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
|
PostsCount int `json:"posts_count"`
|
|
|
|
|
|
FollowersCount int `json:"followers_count"`
|
|
|
|
|
|
FollowingCount int `json:"following_count"`
|
|
|
|
|
|
LastLoginAt string `json:"last_login_at,omitempty"`
|
|
|
|
|
|
LastLoginIP string `json:"last_login_ip,omitempty"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminUserDetailResponse 管理端用户详情响应
|
|
|
|
|
|
type AdminUserDetailResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Username string `json:"username"`
|
|
|
|
|
|
Nickname string `json:"nickname"`
|
|
|
|
|
|
Email *string `json:"email"`
|
|
|
|
|
|
Phone *string `json:"phone"`
|
|
|
|
|
|
EmailVerified bool `json:"email_verified"`
|
|
|
|
|
|
Avatar string `json:"avatar"`
|
|
|
|
|
|
CoverURL string `json:"cover_url"`
|
|
|
|
|
|
Bio string `json:"bio"`
|
|
|
|
|
|
Website string `json:"website"`
|
|
|
|
|
|
Location string `json:"location"`
|
|
|
|
|
|
IsVerified bool `json:"is_verified"`
|
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
|
PostsCount int `json:"posts_count"`
|
|
|
|
|
|
CommentsCount int64 `json:"comments_count"`
|
|
|
|
|
|
FollowersCount int `json:"followers_count"`
|
|
|
|
|
|
FollowingCount int `json:"following_count"`
|
|
|
|
|
|
LastLoginAt string `json:"last_login_at,omitempty"`
|
|
|
|
|
|
LastLoginIP string `json:"last_login_ip,omitempty"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
UpdatedAt string `json:"updated_at"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminUpdateUserStatusRequest 更新用户状态请求
|
|
|
|
|
|
type AdminUpdateUserStatusRequest struct {
|
|
|
|
|
|
Status string `json:"status" binding:"required,oneof=active banned"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-09 21:28:58 +08:00
|
|
|
|
// ==================== Post DTOs ====================
|
|
|
|
|
|
|
2026-03-25 00:58:41 +08:00
|
|
|
|
// PostChannelBrief 帖子所属频道(列表/详情卡片展示)
|
|
|
|
|
|
type PostChannelBrief struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-09 21:28:58 +08:00
|
|
|
|
// PostImageResponse 帖子图片响应
|
|
|
|
|
|
type PostImageResponse struct {
|
2026-03-15 02:25:10 +08:00
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
URL string `json:"url"`
|
|
|
|
|
|
ThumbnailURL string `json:"thumbnail_url"`
|
|
|
|
|
|
PreviewURL string `json:"preview_url"` // 列表/网格预览图
|
|
|
|
|
|
PreviewURLLarge string `json:"preview_url_large"` // 详情页预览图
|
|
|
|
|
|
Width int `json:"width"`
|
|
|
|
|
|
Height int `json:"height"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PostResponse 帖子响应(列表用)
|
|
|
|
|
|
type PostResponse struct {
|
2026-04-23 22:29:34 +08:00
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
UserID string `json:"user_id"`
|
|
|
|
|
|
ChannelID *string `json:"channel_id,omitempty"`
|
|
|
|
|
|
Title string `json:"title"`
|
|
|
|
|
|
Content string `json:"content"`
|
|
|
|
|
|
Segments model.MessageSegments `json:"segments,omitempty"`
|
|
|
|
|
|
Images []PostImageResponse `json:"images"`
|
|
|
|
|
|
Status string `json:"status,omitempty"`
|
|
|
|
|
|
LikesCount int `json:"likes_count"`
|
|
|
|
|
|
CommentsCount int `json:"comments_count"`
|
|
|
|
|
|
FavoritesCount int `json:"favorites_count"`
|
|
|
|
|
|
SharesCount int `json:"shares_count"`
|
|
|
|
|
|
ViewsCount int `json:"views_count"`
|
|
|
|
|
|
IsPinned bool `json:"is_pinned"`
|
|
|
|
|
|
IsLocked bool `json:"is_locked"`
|
|
|
|
|
|
IsVote bool `json:"is_vote"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
UpdatedAt string `json:"updated_at"`
|
|
|
|
|
|
ContentEditedAt string `json:"content_edited_at,omitempty"`
|
|
|
|
|
|
Author *UserResponse `json:"author"`
|
|
|
|
|
|
IsLiked bool `json:"is_liked"`
|
|
|
|
|
|
IsFavorited bool `json:"is_favorited"`
|
|
|
|
|
|
Channel *PostChannelBrief `json:"channel,omitempty"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PostDetailResponse 帖子详情响应
|
|
|
|
|
|
type PostDetailResponse struct {
|
2026-04-23 22:29:34 +08:00
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
UserID string `json:"user_id"`
|
|
|
|
|
|
ChannelID *string `json:"channel_id,omitempty"`
|
|
|
|
|
|
Title string `json:"title"`
|
|
|
|
|
|
Content string `json:"content"`
|
|
|
|
|
|
Segments model.MessageSegments `json:"segments,omitempty"`
|
|
|
|
|
|
Images []PostImageResponse `json:"images"`
|
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
|
LikesCount int `json:"likes_count"`
|
|
|
|
|
|
CommentsCount int `json:"comments_count"`
|
|
|
|
|
|
FavoritesCount int `json:"favorites_count"`
|
|
|
|
|
|
SharesCount int `json:"shares_count"`
|
|
|
|
|
|
ViewsCount int `json:"views_count"`
|
|
|
|
|
|
IsPinned bool `json:"is_pinned"`
|
|
|
|
|
|
IsLocked bool `json:"is_locked"`
|
|
|
|
|
|
IsVote bool `json:"is_vote"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
UpdatedAt string `json:"updated_at"`
|
|
|
|
|
|
ContentEditedAt string `json:"content_edited_at,omitempty"`
|
|
|
|
|
|
Author *UserResponse `json:"author"`
|
|
|
|
|
|
IsLiked bool `json:"is_liked"`
|
|
|
|
|
|
IsFavorited bool `json:"is_favorited"`
|
|
|
|
|
|
Channel *PostChannelBrief `json:"channel,omitempty"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Comment DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// CommentImageResponse 评论图片响应
|
|
|
|
|
|
type CommentImageResponse struct {
|
|
|
|
|
|
URL string `json:"url"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CommentResponse 评论响应(扁平化结构,类似B站/抖音)
|
|
|
|
|
|
// 第一层级正常展示,第二三四五层级在第一层级的评论区扁平展示
|
|
|
|
|
|
type CommentResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
PostID string `json:"post_id"`
|
|
|
|
|
|
UserID string `json:"user_id"`
|
|
|
|
|
|
ParentID *string `json:"parent_id"`
|
|
|
|
|
|
RootID *string `json:"root_id"`
|
|
|
|
|
|
Content string `json:"content"`
|
2026-04-23 22:29:34 +08:00
|
|
|
|
Segments model.MessageSegments `json:"segments,omitempty"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
Images []CommentImageResponse `json:"images"`
|
|
|
|
|
|
LikesCount int `json:"likes_count"`
|
|
|
|
|
|
RepliesCount int `json:"replies_count"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
Author *UserResponse `json:"author"`
|
|
|
|
|
|
IsLiked bool `json:"is_liked"`
|
|
|
|
|
|
TargetID *string `json:"target_id,omitempty"` // 被回复的评论ID,前端根据此ID找到被回复用户的昵称
|
|
|
|
|
|
Replies []*CommentResponse `json:"replies,omitempty"` // 子回复列表(扁平化,所有层级都在这里)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Notification DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// NotificationResponse 通知响应
|
|
|
|
|
|
type NotificationResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
UserID string `json:"user_id"`
|
|
|
|
|
|
Type string `json:"type"`
|
|
|
|
|
|
Title string `json:"title"`
|
|
|
|
|
|
Content string `json:"content"`
|
|
|
|
|
|
Data string `json:"data"`
|
|
|
|
|
|
IsRead bool `json:"is_read"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Message Segment DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// SegmentType Segment类型
|
|
|
|
|
|
type SegmentType string
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
SegmentTypeText SegmentType = "text"
|
|
|
|
|
|
SegmentTypeImage SegmentType = "image"
|
|
|
|
|
|
SegmentTypeVoice SegmentType = "voice"
|
|
|
|
|
|
SegmentTypeVideo SegmentType = "video"
|
|
|
|
|
|
SegmentTypeFile SegmentType = "file"
|
|
|
|
|
|
SegmentTypeAt SegmentType = "at"
|
|
|
|
|
|
SegmentTypeReply SegmentType = "reply"
|
|
|
|
|
|
SegmentTypeFace SegmentType = "face"
|
2026-04-26 00:37:20 +08:00
|
|
|
|
SegmentTypeLink SegmentType = "link"
|
|
|
|
|
|
SegmentTypeVote SegmentType = "vote"
|
|
|
|
|
|
SegmentTypePostRef SegmentType = "post_ref"
|
2026-03-09 21:28:58 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// TextSegmentData 文本数据
|
|
|
|
|
|
type TextSegmentData struct {
|
|
|
|
|
|
Text string `json:"text"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ImageSegmentData 图片数据
|
|
|
|
|
|
type ImageSegmentData struct {
|
|
|
|
|
|
URL string `json:"url"`
|
2026-03-17 00:47:17 +08:00
|
|
|
|
Width int `json:"width,omitzero"`
|
|
|
|
|
|
Height int `json:"height,omitzero"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
ThumbnailURL string `json:"thumbnail_url,omitempty"`
|
2026-03-17 00:47:17 +08:00
|
|
|
|
FileSize int64 `json:"file_size,omitzero"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// VoiceSegmentData 语音数据
|
|
|
|
|
|
type VoiceSegmentData struct {
|
|
|
|
|
|
URL string `json:"url"`
|
2026-03-17 00:47:17 +08:00
|
|
|
|
Duration int `json:"duration,omitzero"` // 秒
|
|
|
|
|
|
FileSize int64 `json:"file_size,omitzero"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// VideoSegmentData 视频数据
|
|
|
|
|
|
type VideoSegmentData struct {
|
|
|
|
|
|
URL string `json:"url"`
|
2026-03-17 00:47:17 +08:00
|
|
|
|
Width int `json:"width,omitzero"`
|
|
|
|
|
|
Height int `json:"height,omitzero"`
|
|
|
|
|
|
Duration int `json:"duration,omitzero"` // 秒
|
2026-03-09 21:28:58 +08:00
|
|
|
|
ThumbnailURL string `json:"thumbnail_url,omitempty"`
|
2026-03-17 00:47:17 +08:00
|
|
|
|
FileSize int64 `json:"file_size,omitzero"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// FileSegmentData 文件数据
|
|
|
|
|
|
type FileSegmentData struct {
|
|
|
|
|
|
URL string `json:"url"`
|
|
|
|
|
|
Name string `json:"name"`
|
2026-03-17 00:47:17 +08:00
|
|
|
|
Size int64 `json:"size,omitzero"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
MimeType string `json:"mime_type,omitempty"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AtSegmentData @数据
|
|
|
|
|
|
type AtSegmentData struct {
|
|
|
|
|
|
UserID string `json:"user_id"` // "all" 表示@所有人
|
|
|
|
|
|
Nickname string `json:"nickname,omitempty"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ReplySegmentData 回复数据
|
|
|
|
|
|
type ReplySegmentData struct {
|
|
|
|
|
|
ID string `json:"id"` // 被回复消息的ID
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// FaceSegmentData 表情数据
|
|
|
|
|
|
type FaceSegmentData struct {
|
2026-03-17 00:47:17 +08:00
|
|
|
|
ID int `json:"id,omitzero"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
|
|
URL string `json:"url,omitempty"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// LinkSegmentData 链接数据
|
|
|
|
|
|
type LinkSegmentData struct {
|
|
|
|
|
|
URL string `json:"url"`
|
|
|
|
|
|
Title string `json:"title,omitempty"`
|
|
|
|
|
|
Description string `json:"description,omitempty"`
|
|
|
|
|
|
Image string `json:"image,omitempty"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-23 22:29:34 +08:00
|
|
|
|
// VoteOptionData 投票选项数据
|
|
|
|
|
|
type VoteOptionData struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Content string `json:"content"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-26 00:37:20 +08:00
|
|
|
|
// PostRefSegmentData 帖子内链Segment数据
|
|
|
|
|
|
type PostRefSegmentData struct {
|
|
|
|
|
|
PostID string `json:"post_id"`
|
|
|
|
|
|
Title string `json:"title,omitempty"`
|
|
|
|
|
|
Author *UserResponse `json:"author,omitempty"`
|
|
|
|
|
|
Status string `json:"status,omitempty"`
|
|
|
|
|
|
Accessible bool `json:"accessible"`
|
|
|
|
|
|
ClickCount int `json:"click_count,omitzero"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PostRefBrief 帖子内链简要信息 (用于搜索联想)
|
|
|
|
|
|
type PostRefBrief struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Title string `json:"title"`
|
|
|
|
|
|
Channel string `json:"channel,omitempty"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-23 22:29:34 +08:00
|
|
|
|
// VoteSegmentData 投票Segment数据
|
|
|
|
|
|
type VoteSegmentData struct {
|
|
|
|
|
|
Options []VoteOptionData `json:"options"`
|
|
|
|
|
|
MaxChoices int `json:"max_choices,omitempty"`
|
|
|
|
|
|
IsMultiChoice bool `json:"is_multi_choice,omitempty"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-09 21:28:58 +08:00
|
|
|
|
// ==================== Message DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// MessageResponse 消息响应
|
|
|
|
|
|
type MessageResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
ConversationID string `json:"conversation_id"`
|
|
|
|
|
|
SenderID string `json:"sender_id"`
|
|
|
|
|
|
Seq int64 `json:"seq"`
|
|
|
|
|
|
Segments model.MessageSegments `json:"segments"` // 消息链(必须)
|
|
|
|
|
|
ReplyToID *string `json:"reply_to_id,omitempty"` // 被回复消息的ID(用于关联查找)
|
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
|
Category string `json:"category,omitempty"` // 消息类别:chat, notification, announcement
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
Sender *UserResponse `json:"sender"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ConversationResponse 会话响应
|
|
|
|
|
|
type ConversationResponse struct {
|
2026-04-25 21:22:52 +08:00
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Type string `json:"type"`
|
|
|
|
|
|
IsPinned bool `json:"is_pinned"`
|
|
|
|
|
|
NotificationMuted bool `json:"notification_muted"`
|
|
|
|
|
|
Group *GroupResponse `json:"group,omitempty"`
|
|
|
|
|
|
LastSeq int64 `json:"last_seq"`
|
|
|
|
|
|
LastMessage *MessageResponse `json:"last_message"`
|
|
|
|
|
|
LastMessageAt string `json:"last_message_at"`
|
|
|
|
|
|
UnreadCount int `json:"unread_count"`
|
|
|
|
|
|
Participants []*UserResponse `json:"participants,omitempty"` // 私聊时使用
|
|
|
|
|
|
MemberCount int `json:"member_count,omitempty"` // 群聊时使用
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
UpdatedAt string `json:"updated_at"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ConversationParticipantResponse 会话参与者响应
|
|
|
|
|
|
type ConversationParticipantResponse struct {
|
2026-04-25 21:22:52 +08:00
|
|
|
|
UserID string `json:"user_id"`
|
|
|
|
|
|
LastReadSeq int64 `json:"last_read_seq"`
|
|
|
|
|
|
NotificationMuted bool `json:"notification_muted"`
|
|
|
|
|
|
IsPinned bool `json:"is_pinned"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Auth DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// LoginResponse 登录响应
|
|
|
|
|
|
type LoginResponse struct {
|
|
|
|
|
|
User *UserResponse `json:"user"`
|
|
|
|
|
|
AccessToken string `json:"access_token"`
|
|
|
|
|
|
RefreshToken string `json:"refresh_token"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// RegisterResponse 注册响应
|
|
|
|
|
|
type RegisterResponse struct {
|
|
|
|
|
|
User *UserResponse `json:"user"`
|
|
|
|
|
|
AccessToken string `json:"access_token"`
|
|
|
|
|
|
RefreshToken string `json:"refresh_token"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// RefreshTokenResponse 刷新Token响应
|
|
|
|
|
|
type RefreshTokenResponse struct {
|
|
|
|
|
|
AccessToken string `json:"access_token"`
|
|
|
|
|
|
RefreshToken string `json:"refresh_token"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Common DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// SuccessResponse 通用成功响应
|
|
|
|
|
|
type SuccessResponse struct {
|
|
|
|
|
|
Success bool `json:"success"`
|
|
|
|
|
|
Message string `json:"message"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AvailableResponse 可用性检查响应
|
|
|
|
|
|
type AvailableResponse struct {
|
|
|
|
|
|
Available bool `json:"available"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CountResponse 数量响应
|
|
|
|
|
|
type CountResponse struct {
|
|
|
|
|
|
Count int `json:"count"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// URLResponse URL响应
|
|
|
|
|
|
type URLResponse struct {
|
|
|
|
|
|
URL string `json:"url"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Chat Request DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// CreateConversationRequest 创建会话请求
|
|
|
|
|
|
type CreateConversationRequest struct {
|
|
|
|
|
|
UserID string `json:"user_id" binding:"required"` // 目标用户ID (UUID格式)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SendMessageRequest 发送消息请求
|
|
|
|
|
|
type SendMessageRequest struct {
|
|
|
|
|
|
Segments model.MessageSegments `json:"segments" binding:"required"` // 消息链(必须)
|
|
|
|
|
|
ReplyToID *string `json:"reply_to_id,omitempty"` // 回复的消息ID (string类型)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MarkReadRequest 标记已读请求
|
|
|
|
|
|
type MarkReadRequest struct {
|
|
|
|
|
|
LastReadSeq int64 `json:"last_read_seq" binding:"required"` // 已读到的seq位置
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetConversationPinnedRequest 设置会话置顶请求
|
|
|
|
|
|
type SetConversationPinnedRequest struct {
|
|
|
|
|
|
ConversationID string `json:"conversation_id" binding:"required"`
|
|
|
|
|
|
IsPinned bool `json:"is_pinned"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Chat Response DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// ConversationListResponse 会话列表响应
|
|
|
|
|
|
type ConversationListResponse struct {
|
|
|
|
|
|
Conversations []*ConversationResponse `json:"list"`
|
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
|
Page int `json:"page"`
|
|
|
|
|
|
PageSize int `json:"page_size"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ConversationDetailResponse 会话详情响应
|
|
|
|
|
|
type ConversationDetailResponse struct {
|
2026-04-25 21:22:52 +08:00
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Type string `json:"type"`
|
|
|
|
|
|
IsPinned bool `json:"is_pinned"`
|
|
|
|
|
|
NotificationMuted bool `json:"notification_muted"`
|
|
|
|
|
|
LastSeq int64 `json:"last_seq"`
|
|
|
|
|
|
LastMessage *MessageResponse `json:"last_message"`
|
|
|
|
|
|
LastMessageAt string `json:"last_message_at"`
|
|
|
|
|
|
UnreadCount int64 `json:"unread_count"`
|
|
|
|
|
|
Participants []*UserResponse `json:"participants"`
|
|
|
|
|
|
MyLastReadSeq int64 `json:"my_last_read_seq"` // 当前用户的已读位置
|
|
|
|
|
|
OtherLastReadSeq int64 `json:"other_last_read_seq"` // 对方用户的已读位置
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
UpdatedAt string `json:"updated_at"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UnreadCountResponse 未读数响应
|
|
|
|
|
|
type UnreadCountResponse struct {
|
|
|
|
|
|
TotalUnreadCount int64 `json:"total_unread_count"` // 所有会话的未读总数
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ConversationUnreadCountResponse 单个会话未读数响应
|
|
|
|
|
|
type ConversationUnreadCountResponse struct {
|
|
|
|
|
|
ConversationID string `json:"conversation_id"`
|
|
|
|
|
|
UnreadCount int64 `json:"unread_count"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MessageListResponse 消息列表响应
|
|
|
|
|
|
type MessageListResponse struct {
|
|
|
|
|
|
Messages []*MessageResponse `json:"messages"`
|
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
|
Page int `json:"page"`
|
|
|
|
|
|
PageSize int `json:"page_size"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MessageSyncResponse 消息同步响应(增量同步)
|
|
|
|
|
|
type MessageSyncResponse struct {
|
|
|
|
|
|
Messages []*MessageResponse `json:"messages"`
|
|
|
|
|
|
HasMore bool `json:"has_more"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== 设备Token DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// RegisterDeviceRequest 注册设备请求
|
|
|
|
|
|
type RegisterDeviceRequest struct {
|
|
|
|
|
|
DeviceID string `json:"device_id" binding:"required"`
|
|
|
|
|
|
DeviceType string `json:"device_type" binding:"required,oneof=ios android web"`
|
|
|
|
|
|
PushToken string `json:"push_token"`
|
|
|
|
|
|
DeviceName string `json:"device_name"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// DeviceTokenResponse 设备Token响应
|
|
|
|
|
|
type DeviceTokenResponse struct {
|
|
|
|
|
|
ID int64 `json:"id"`
|
|
|
|
|
|
DeviceID string `json:"device_id"`
|
|
|
|
|
|
DeviceType string `json:"device_type"`
|
|
|
|
|
|
IsActive bool `json:"is_active"`
|
|
|
|
|
|
DeviceName string `json:"device_name"`
|
2026-03-17 00:47:17 +08:00
|
|
|
|
LastUsedAt time.Time `json:"last_used_at,omitzero"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
CreatedAt time.Time `json:"created_at"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== 推送记录 DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// PushRecordResponse 推送记录响应
|
|
|
|
|
|
type PushRecordResponse struct {
|
|
|
|
|
|
ID int64 `json:"id"`
|
|
|
|
|
|
MessageID string `json:"message_id"`
|
|
|
|
|
|
PushChannel string `json:"push_channel"`
|
|
|
|
|
|
PushStatus string `json:"push_status"`
|
2026-03-17 00:47:17 +08:00
|
|
|
|
RetryCount int `json:"retry_count,omitzero"`
|
|
|
|
|
|
PushedAt time.Time `json:"pushed_at,omitzero"`
|
|
|
|
|
|
DeliveredAt time.Time `json:"delivered_at,omitzero"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
CreatedAt time.Time `json:"created_at"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PushRecordListResponse 推送记录列表响应
|
|
|
|
|
|
type PushRecordListResponse struct {
|
|
|
|
|
|
Records []*PushRecordResponse `json:"records"`
|
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== 系统消息 DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// SystemMessageResponse 系统消息响应
|
|
|
|
|
|
type SystemMessageResponse struct {
|
2026-03-30 04:49:35 +08:00
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
SenderID string `json:"sender_id"`
|
|
|
|
|
|
ReceiverID string `json:"receiver_id"`
|
|
|
|
|
|
Content string `json:"content"`
|
|
|
|
|
|
Category string `json:"category"`
|
|
|
|
|
|
SystemType string `json:"system_type"`
|
|
|
|
|
|
ExtraData map[string]any `json:"extra_data,omitempty"`
|
|
|
|
|
|
IsRead bool `json:"is_read"`
|
|
|
|
|
|
CreatedAt time.Time `json:"created_at"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SystemMessageListResponse 系统消息列表响应
|
|
|
|
|
|
type SystemMessageListResponse struct {
|
|
|
|
|
|
Messages []*SystemMessageResponse `json:"messages"`
|
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
|
Page int `json:"page"`
|
|
|
|
|
|
PageSize int `json:"page_size"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SystemUnreadCountResponse 系统消息未读数响应
|
|
|
|
|
|
type SystemUnreadCountResponse struct {
|
|
|
|
|
|
UnreadCount int64 `json:"unread_count"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-21 02:48:06 +08:00
|
|
|
|
// SystemMessageCursorPageResponse 系统消息游标分页响应
|
|
|
|
|
|
type SystemMessageCursorPageResponse struct {
|
2026-03-23 01:06:41 +08:00
|
|
|
|
Items []*SystemMessageResponse `json:"list"`
|
2026-03-21 02:48:06 +08:00
|
|
|
|
NextCursor string `json:"next_cursor"`
|
|
|
|
|
|
PrevCursor string `json:"prev_cursor"`
|
|
|
|
|
|
HasMore bool `json:"has_more"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-09 21:28:58 +08:00
|
|
|
|
// ==================== 时间格式化 ====================
|
|
|
|
|
|
|
|
|
|
|
|
// FormatTime 格式化时间
|
|
|
|
|
|
func FormatTime(t time.Time) string {
|
|
|
|
|
|
if t.IsZero() {
|
|
|
|
|
|
return ""
|
|
|
|
|
|
}
|
|
|
|
|
|
return t.Format("2006-01-02T15:04:05Z07:00")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// FormatTimePointer 格式化时间指针
|
|
|
|
|
|
func FormatTimePointer(t *time.Time) string {
|
|
|
|
|
|
if t == nil {
|
|
|
|
|
|
return ""
|
|
|
|
|
|
}
|
|
|
|
|
|
return FormatTime(*t)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Group DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// CreateGroupRequest 创建群组请求
|
|
|
|
|
|
type CreateGroupRequest struct {
|
|
|
|
|
|
Name string `json:"name" binding:"required,max=50"`
|
|
|
|
|
|
Description string `json:"description" binding:"max=500"`
|
|
|
|
|
|
MemberIDs []string `json:"member_ids"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UpdateGroupRequest 更新群组请求
|
|
|
|
|
|
type UpdateGroupRequest struct {
|
|
|
|
|
|
Name string `json:"name" binding:"omitempty,max=50"`
|
|
|
|
|
|
Description string `json:"description" binding:"omitempty,max=500"`
|
|
|
|
|
|
Avatar string `json:"avatar" binding:"omitempty,url"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// InviteMembersRequest 邀请成员请求
|
|
|
|
|
|
type InviteMembersRequest struct {
|
|
|
|
|
|
MemberIDs []string `json:"member_ids" binding:"required,min=1"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TransferOwnerRequest 转让群主请求
|
|
|
|
|
|
type TransferOwnerRequest struct {
|
|
|
|
|
|
NewOwnerID string `json:"new_owner_id" binding:"required"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetRoleRequest 设置角色请求
|
|
|
|
|
|
type SetRoleRequest struct {
|
|
|
|
|
|
Role string `json:"role" binding:"required,oneof=admin member"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetNicknameRequest 设置昵称请求
|
|
|
|
|
|
type SetNicknameRequest struct {
|
|
|
|
|
|
Nickname string `json:"nickname" binding:"max=50"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MuteMemberRequest 禁言成员请求
|
|
|
|
|
|
type MuteMemberRequest struct {
|
|
|
|
|
|
Muted bool `json:"muted"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetMuteAllRequest 设置全员禁言请求
|
|
|
|
|
|
type SetMuteAllRequest struct {
|
|
|
|
|
|
MuteAll bool `json:"mute_all"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetJoinTypeRequest 设置加群方式请求
|
|
|
|
|
|
type SetJoinTypeRequest struct {
|
|
|
|
|
|
JoinType int `json:"join_type" binding:"min=0,max=2"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CreateAnnouncementRequest 创建群公告请求
|
|
|
|
|
|
type CreateAnnouncementRequest struct {
|
|
|
|
|
|
Content string `json:"content" binding:"required,max=2000"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GroupResponse 群组响应
|
|
|
|
|
|
type GroupResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
|
Avatar string `json:"avatar"`
|
|
|
|
|
|
Description string `json:"description"`
|
|
|
|
|
|
OwnerID string `json:"owner_id"`
|
|
|
|
|
|
MemberCount int `json:"member_count"`
|
|
|
|
|
|
MaxMembers int `json:"max_members"`
|
|
|
|
|
|
JoinType int `json:"join_type"`
|
|
|
|
|
|
MuteAll bool `json:"mute_all"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GroupMemberResponse 群成员响应
|
|
|
|
|
|
type GroupMemberResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
GroupID string `json:"group_id"`
|
|
|
|
|
|
UserID string `json:"user_id"`
|
|
|
|
|
|
Role string `json:"role"`
|
|
|
|
|
|
Nickname string `json:"nickname"`
|
|
|
|
|
|
Muted bool `json:"muted"`
|
|
|
|
|
|
JoinTime string `json:"join_time"`
|
|
|
|
|
|
User *UserResponse `json:"user,omitempty"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GroupAnnouncementResponse 群公告响应
|
|
|
|
|
|
type GroupAnnouncementResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
GroupID string `json:"group_id"`
|
|
|
|
|
|
Content string `json:"content"`
|
|
|
|
|
|
AuthorID string `json:"author_id"`
|
|
|
|
|
|
IsPinned bool `json:"is_pinned"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GroupListResponse 群组列表响应
|
|
|
|
|
|
type GroupListResponse struct {
|
|
|
|
|
|
List []*GroupResponse `json:"list"`
|
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
|
Page int `json:"page"`
|
|
|
|
|
|
PageSize int `json:"page_size"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GroupMemberListResponse 群成员列表响应
|
|
|
|
|
|
type GroupMemberListResponse struct {
|
|
|
|
|
|
List []*GroupMemberResponse `json:"list"`
|
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
|
Page int `json:"page"`
|
|
|
|
|
|
PageSize int `json:"page_size"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GroupAnnouncementListResponse 群公告列表响应
|
|
|
|
|
|
type GroupAnnouncementListResponse struct {
|
|
|
|
|
|
List []*GroupAnnouncementResponse `json:"list"`
|
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
|
Page int `json:"page"`
|
|
|
|
|
|
PageSize int `json:"page_size"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== WebSocket Event DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// WSEventResponse WebSocket事件响应结构体
|
|
|
|
|
|
// 用于后端推送消息给前端的标准格式
|
|
|
|
|
|
type WSEventResponse struct {
|
2026-03-28 07:03:21 +08:00
|
|
|
|
ID string `json:"id"` // 事件唯一ID (UUID)
|
|
|
|
|
|
Time int64 `json:"time"` // 时间戳 (毫秒)
|
|
|
|
|
|
Type string `json:"type"` // 事件类型 (message, notification, system等)
|
|
|
|
|
|
DetailType string `json:"detail_type"` // 详细类型 (private, group, like, comment等)
|
|
|
|
|
|
ConversationID string `json:"conversation_id"` // 会话ID
|
|
|
|
|
|
Seq string `json:"seq"` // 消息序列号
|
|
|
|
|
|
Segments model.MessageSegments `json:"segments"` // 消息段数组
|
|
|
|
|
|
SenderID string `json:"sender_id"` // 发送者用户ID
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== WebSocket Request DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// SendMessageParams 发送消息参数(用于 REST API)
|
|
|
|
|
|
type SendMessageParams struct {
|
|
|
|
|
|
DetailType string `json:"detail_type"` // 消息类型: private, group
|
|
|
|
|
|
ConversationID string `json:"conversation_id"` // 会话ID
|
|
|
|
|
|
Segments model.MessageSegments `json:"segments"` // 消息内容(消息段数组)
|
|
|
|
|
|
ReplyToID *string `json:"reply_to_id,omitempty"` // 回复的消息ID
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// DeleteMsgParams 撤回消息参数
|
|
|
|
|
|
type DeleteMsgParams struct {
|
|
|
|
|
|
MessageID string `json:"message_id"` // 消息ID
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Group Action Params ====================
|
|
|
|
|
|
|
|
|
|
|
|
// SetGroupKickParams 群组踢人参数
|
|
|
|
|
|
type SetGroupKickParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
UserID string `json:"user_id"` // 被踢用户ID
|
|
|
|
|
|
RejectAddRequest bool `json:"reject_add_request"` // 是否拒绝再次加群
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetGroupBanParams 群组单人禁言参数
|
|
|
|
|
|
type SetGroupBanParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
UserID string `json:"user_id"` // 被禁言用户ID
|
|
|
|
|
|
Duration int64 `json:"duration"` // 禁言时长(秒),0表示解除禁言
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetGroupWholeBanParams 群组全员禁言参数
|
|
|
|
|
|
type SetGroupWholeBanParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
Enable bool `json:"enable"` // 是否开启全员禁言
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetGroupAdminParams 群组设置管理员参数
|
|
|
|
|
|
type SetGroupAdminParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
UserID string `json:"user_id"` // 被设置的用户ID
|
|
|
|
|
|
Enable bool `json:"enable"` // 是否设置为管理员
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetGroupNameParams 设置群名参数
|
|
|
|
|
|
type SetGroupNameParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
GroupName string `json:"group_name"` // 新群名
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetGroupAvatarParams 设置群头像参数
|
|
|
|
|
|
type SetGroupAvatarParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
Avatar string `json:"avatar"` // 头像URL
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetGroupLeaveParams 退出群组参数
|
|
|
|
|
|
type SetGroupLeaveParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetGroupAddRequestParams 处理加群请求参数
|
|
|
|
|
|
type SetGroupAddRequestParams struct {
|
|
|
|
|
|
Flag string `json:"flag"` // 加群请求的flag标识
|
|
|
|
|
|
Approve bool `json:"approve"` // 是否同意
|
|
|
|
|
|
Reason string `json:"reason"` // 拒绝理由(当approve为false时)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetConversationListParams 获取会话列表参数
|
|
|
|
|
|
type GetConversationListParams struct {
|
|
|
|
|
|
Page int `json:"page"` // 页码
|
|
|
|
|
|
PageSize int `json:"page_size"` // 每页数量
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetGroupInfoParams 获取群信息参数
|
|
|
|
|
|
type GetGroupInfoParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetGroupMemberListParams 获取群成员列表参数
|
|
|
|
|
|
type GetGroupMemberListParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
Page int `json:"page"` // 页码
|
|
|
|
|
|
PageSize int `json:"page_size"` // 每页数量
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Conversation Action Params ====================
|
|
|
|
|
|
|
|
|
|
|
|
// CreateConversationParams 创建会话参数
|
|
|
|
|
|
type CreateConversationParams struct {
|
|
|
|
|
|
UserID string `json:"user_id"` // 目标用户ID(私聊)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MarkReadParams 标记已读参数
|
|
|
|
|
|
type MarkReadParams struct {
|
|
|
|
|
|
ConversationID string `json:"conversation_id"` // 会话ID
|
|
|
|
|
|
LastReadSeq int64 `json:"last_read_seq"` // 最后已读消息序号
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetConversationPinnedParams 设置会话置顶参数
|
|
|
|
|
|
type SetConversationPinnedParams struct {
|
|
|
|
|
|
ConversationID string `json:"conversation_id"` // 会话ID
|
|
|
|
|
|
IsPinned bool `json:"is_pinned"` // 是否置顶
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Group Action Params (Additional) ====================
|
|
|
|
|
|
|
|
|
|
|
|
// CreateGroupParams 创建群组参数
|
|
|
|
|
|
type CreateGroupParams struct {
|
|
|
|
|
|
Name string `json:"name"` // 群名
|
|
|
|
|
|
Description string `json:"description,omitempty"` // 群描述
|
|
|
|
|
|
MemberIDs []string `json:"member_ids,omitempty"` // 初始成员ID列表
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetUserGroupsParams 获取用户群组列表参数
|
|
|
|
|
|
type GetUserGroupsParams struct {
|
|
|
|
|
|
Page int `json:"page"` // 页码
|
|
|
|
|
|
PageSize int `json:"page_size"` // 每页数量
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TransferOwnerParams 转让群主参数
|
|
|
|
|
|
type TransferOwnerParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
NewOwnerID string `json:"new_owner_id"` // 新群主ID
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// InviteMembersParams 邀请成员参数
|
|
|
|
|
|
type InviteMembersParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
MemberIDs []string `json:"member_ids"` // 被邀请的用户ID列表
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// JoinGroupParams 加入群组参数
|
|
|
|
|
|
type JoinGroupParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetNicknameParams 设置群内昵称参数
|
|
|
|
|
|
type SetNicknameParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
Nickname string `json:"nickname"` // 群内昵称
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SetJoinTypeParams 设置加群方式参数
|
|
|
|
|
|
type SetJoinTypeParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
JoinType int `json:"join_type"` // 加群方式:0-允许任何人加入,1-需要审批,2-不允许加入
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CreateAnnouncementParams 创建群公告参数
|
|
|
|
|
|
type CreateAnnouncementParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
Content string `json:"content"` // 公告内容
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetAnnouncementsParams 获取群公告列表参数
|
|
|
|
|
|
type GetAnnouncementsParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
Page int `json:"page"` // 页码
|
|
|
|
|
|
PageSize int `json:"page_size"` // 每页数量
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// DeleteAnnouncementParams 删除群公告参数
|
|
|
|
|
|
type DeleteAnnouncementParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
AnnouncementID string `json:"announcement_id"` // 公告ID
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// DissolveGroupParams 解散群组参数
|
|
|
|
|
|
type DissolveGroupParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetMyMemberInfoParams 获取我在群组中的成员信息参数
|
|
|
|
|
|
type GetMyMemberInfoParams struct {
|
|
|
|
|
|
GroupID string `json:"group_id"` // 群组ID
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Vote DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// CreateVotePostRequest 创建投票帖子请求
|
|
|
|
|
|
type CreateVotePostRequest struct {
|
|
|
|
|
|
Title string `json:"title" binding:"required,max=200"`
|
|
|
|
|
|
Content string `json:"content" binding:"max=2000"`
|
2026-03-24 22:27:53 +08:00
|
|
|
|
ChannelID *string `json:"channel_id,omitempty"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
Images []string `json:"images"`
|
2026-04-23 22:29:34 +08:00
|
|
|
|
VoteOptions []string `json:"vote_options" binding:"required,min=2,max=10"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CreatePostWithSegmentsRequest 创建帖子请求(含 segments)
|
|
|
|
|
|
type CreatePostWithSegmentsRequest struct {
|
|
|
|
|
|
Title string `json:"title" binding:"required,max=200"`
|
|
|
|
|
|
Content string `json:"content"`
|
|
|
|
|
|
Segments model.MessageSegments `json:"segments"`
|
|
|
|
|
|
Images []string `json:"images"`
|
|
|
|
|
|
ChannelID *string `json:"channel_id,omitempty"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// VoteOptionDTO 投票选项DTO
|
|
|
|
|
|
type VoteOptionDTO struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Content string `json:"content"`
|
|
|
|
|
|
VotesCount int `json:"votes_count"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// VoteResultDTO 投票结果DTO
|
|
|
|
|
|
type VoteResultDTO struct {
|
|
|
|
|
|
Options []VoteOptionDTO `json:"options"`
|
|
|
|
|
|
TotalVotes int `json:"total_votes"`
|
|
|
|
|
|
HasVoted bool `json:"has_voted"`
|
2026-03-17 00:47:17 +08:00
|
|
|
|
VotedOptionID string `json:"voted_option_id,omitzero"`
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== WebSocket Response DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// WSResponse WebSocket响应结构体
|
|
|
|
|
|
type WSResponse struct {
|
2026-03-30 04:49:35 +08:00
|
|
|
|
Success bool `json:"success"` // 是否成功
|
|
|
|
|
|
Action string `json:"action"` // 响应原action
|
|
|
|
|
|
Data any `json:"data,omitempty"` // 响应数据
|
|
|
|
|
|
Error string `json:"error,omitempty"` // 错误信息
|
2026-03-09 21:28:58 +08:00
|
|
|
|
}
|
2026-03-14 18:01:55 +08:00
|
|
|
|
|
|
|
|
|
|
// ==================== Admin Post DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// AdminPostListResponse 管理端帖子列表响应
|
|
|
|
|
|
type AdminPostListResponse struct {
|
2026-03-28 07:03:21 +08:00
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
UserID string `json:"user_id"`
|
|
|
|
|
|
Title string `json:"title"`
|
|
|
|
|
|
Content string `json:"content"`
|
|
|
|
|
|
Images []PostImageResponse `json:"images"`
|
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
|
LikesCount int `json:"likes_count,omitzero"`
|
|
|
|
|
|
CommentsCount int `json:"comments_count,omitzero"`
|
|
|
|
|
|
FavoritesCount int `json:"favorites_count,omitzero"`
|
|
|
|
|
|
ViewsCount int `json:"views_count,omitzero"`
|
|
|
|
|
|
IsPinned bool `json:"is_pinned"`
|
|
|
|
|
|
IsFeatured bool `json:"is_featured"`
|
|
|
|
|
|
IsLocked bool `json:"is_locked"`
|
|
|
|
|
|
RejectReason string `json:"reject_reason,omitempty"`
|
|
|
|
|
|
ReviewedAt string `json:"reviewed_at,omitempty"`
|
|
|
|
|
|
ReviewedBy string `json:"reviewed_by,omitempty"`
|
2026-03-23 14:08:36 +08:00
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
UpdatedAt string `json:"updated_at"`
|
|
|
|
|
|
ContentEditedAt string `json:"content_edited_at,omitempty"`
|
|
|
|
|
|
Author *UserResponse `json:"author"`
|
2026-03-14 18:01:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminPostDetailResponse 管理端帖子详情响应
|
|
|
|
|
|
type AdminPostDetailResponse struct {
|
2026-04-23 22:29:34 +08:00
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
UserID string `json:"user_id"`
|
|
|
|
|
|
ChannelID *string `json:"channel_id,omitempty"`
|
|
|
|
|
|
Title string `json:"title"`
|
|
|
|
|
|
Content string `json:"content"`
|
|
|
|
|
|
Segments model.MessageSegments `json:"segments,omitempty"`
|
|
|
|
|
|
Images []PostImageResponse `json:"images"`
|
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
|
LikesCount int `json:"likes_count,omitzero"`
|
|
|
|
|
|
CommentsCount int `json:"comments_count,omitzero"`
|
|
|
|
|
|
FavoritesCount int `json:"favorites_count,omitzero"`
|
|
|
|
|
|
SharesCount int `json:"shares_count,omitzero"`
|
|
|
|
|
|
ViewsCount int `json:"views_count,omitzero"`
|
|
|
|
|
|
IsPinned bool `json:"is_pinned"`
|
|
|
|
|
|
IsFeatured bool `json:"is_featured"`
|
|
|
|
|
|
IsLocked bool `json:"is_locked"`
|
|
|
|
|
|
IsVote bool `json:"is_vote"`
|
|
|
|
|
|
RejectReason string `json:"reject_reason,omitempty"`
|
|
|
|
|
|
ReviewedAt string `json:"reviewed_at,omitempty"`
|
|
|
|
|
|
ReviewedBy string `json:"reviewed_by,omitempty"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
UpdatedAt string `json:"updated_at"`
|
|
|
|
|
|
ContentEditedAt string `json:"content_edited_at,omitempty"`
|
|
|
|
|
|
Author *UserResponse `json:"author"`
|
2026-03-14 18:01:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminModeratePostRequest 审核帖子请求
|
|
|
|
|
|
type AdminModeratePostRequest struct {
|
|
|
|
|
|
Status string `json:"status" binding:"required,oneof=published rejected"`
|
|
|
|
|
|
Reason string `json:"reason"` // 拒绝理由(当status为rejected时)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminBatchDeletePostsRequest 批量删除帖子请求
|
|
|
|
|
|
type AdminBatchDeletePostsRequest struct {
|
2026-04-07 00:07:40 +08:00
|
|
|
|
IDs []string `json:"ids" binding:"required,min=1,max=100,dive,required"`
|
2026-03-14 18:01:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminBatchModeratePostsRequest 批量审核帖子请求
|
|
|
|
|
|
type AdminBatchModeratePostsRequest struct {
|
2026-04-07 00:07:40 +08:00
|
|
|
|
IDs []string `json:"ids" binding:"required,min=1,max=100,dive,required"`
|
2026-03-14 18:01:55 +08:00
|
|
|
|
Status string `json:"status" binding:"required,oneof=published rejected"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminSetPostPinRequest 置顶帖子请求
|
|
|
|
|
|
type AdminSetPostPinRequest struct {
|
|
|
|
|
|
IsPinned bool `json:"is_pinned"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminSetPostFeatureRequest 加精帖子请求
|
|
|
|
|
|
type AdminSetPostFeatureRequest struct {
|
|
|
|
|
|
IsFeatured bool `json:"is_featured"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminBatchOperationResponse 批量操作响应
|
|
|
|
|
|
type AdminBatchOperationResponse struct {
|
|
|
|
|
|
Success bool `json:"success"`
|
|
|
|
|
|
Message string `json:"message"`
|
|
|
|
|
|
Failed []string `json:"failed,omitempty"` // 失败的ID列表
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Admin Comment DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// AdminCommentListResponse 管理端评论列表响应
|
|
|
|
|
|
type AdminCommentListResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
PostID string `json:"post_id"`
|
|
|
|
|
|
UserID string `json:"user_id"`
|
|
|
|
|
|
ParentID *string `json:"parent_id"`
|
|
|
|
|
|
RootID *string `json:"root_id"`
|
|
|
|
|
|
Content string `json:"content"`
|
|
|
|
|
|
Images []CommentImageResponse `json:"images"`
|
|
|
|
|
|
Status string `json:"status"`
|
2026-04-11 04:23:24 +08:00
|
|
|
|
RejectReason string `json:"reject_reason,omitempty"`
|
|
|
|
|
|
ReviewedAt string `json:"reviewed_at,omitempty"`
|
|
|
|
|
|
ReviewedBy string `json:"reviewed_by,omitempty"`
|
2026-03-14 18:01:55 +08:00
|
|
|
|
LikesCount int `json:"likes_count"`
|
|
|
|
|
|
RepliesCount int `json:"replies_count"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
UpdatedAt string `json:"updated_at"`
|
|
|
|
|
|
Author *UserResponse `json:"author"`
|
|
|
|
|
|
Post *AdminCommentPostInfo `json:"post"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminCommentPostInfo 评论关联的帖子简要信息
|
|
|
|
|
|
type AdminCommentPostInfo struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Title string `json:"title"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminCommentDetailResponse 管理端评论详情响应
|
|
|
|
|
|
type AdminCommentDetailResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
PostID string `json:"post_id"`
|
|
|
|
|
|
UserID string `json:"user_id"`
|
|
|
|
|
|
ParentID *string `json:"parent_id"`
|
|
|
|
|
|
RootID *string `json:"root_id"`
|
|
|
|
|
|
Content string `json:"content"`
|
|
|
|
|
|
Images []CommentImageResponse `json:"images"`
|
|
|
|
|
|
Status string `json:"status"`
|
2026-04-11 04:23:24 +08:00
|
|
|
|
RejectReason string `json:"reject_reason,omitempty"`
|
|
|
|
|
|
ReviewedAt string `json:"reviewed_at,omitempty"`
|
|
|
|
|
|
ReviewedBy string `json:"reviewed_by,omitempty"`
|
2026-03-14 18:01:55 +08:00
|
|
|
|
LikesCount int `json:"likes_count"`
|
|
|
|
|
|
RepliesCount int `json:"replies_count"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
UpdatedAt string `json:"updated_at"`
|
|
|
|
|
|
Author *UserResponse `json:"author"`
|
|
|
|
|
|
Post *AdminCommentPostInfo `json:"post"`
|
2026-04-11 04:23:24 +08:00
|
|
|
|
ReplyToUser *UserResponse `json:"reply_to_user,omitempty"`
|
2026-03-14 18:01:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminBatchDeleteCommentsRequest 批量删除评论请求
|
|
|
|
|
|
type AdminBatchDeleteCommentsRequest struct {
|
2026-04-07 00:07:40 +08:00
|
|
|
|
IDs []string `json:"ids" binding:"required,min=1,max=100,dive,required"`
|
2026-03-14 18:01:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-11 04:23:24 +08:00
|
|
|
|
// AdminModerateCommentRequest 审核评论请求
|
|
|
|
|
|
type AdminModerateCommentRequest struct {
|
|
|
|
|
|
Status string `json:"status" binding:"required,oneof=published rejected"`
|
|
|
|
|
|
Reason string `json:"reason"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminBatchModerateCommentsRequest 批量审核评论请求
|
|
|
|
|
|
type AdminBatchModerateCommentsRequest struct {
|
|
|
|
|
|
IDs []string `json:"ids" binding:"required,min=1,max=100,dive,required"`
|
|
|
|
|
|
Status string `json:"status" binding:"required,oneof=published rejected"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-14 18:01:55 +08:00
|
|
|
|
// ==================== Admin Group DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// AdminGroupListResponse 管理端群组列表响应
|
|
|
|
|
|
type AdminGroupListResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
|
Avatar string `json:"avatar"`
|
|
|
|
|
|
Description string `json:"description"`
|
|
|
|
|
|
OwnerID string `json:"owner_id"`
|
|
|
|
|
|
Owner *UserResponse `json:"owner"`
|
|
|
|
|
|
MemberCount int `json:"member_count"`
|
|
|
|
|
|
MaxMembers int `json:"max_members"`
|
|
|
|
|
|
JoinType int `json:"join_type"`
|
|
|
|
|
|
MuteAll bool `json:"mute_all"`
|
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
|
PostCount int64 `json:"post_count"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
UpdatedAt string `json:"updated_at"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminGroupDetailResponse 管理端群组详情响应
|
|
|
|
|
|
type AdminGroupDetailResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
|
Avatar string `json:"avatar"`
|
|
|
|
|
|
Description string `json:"description"`
|
|
|
|
|
|
OwnerID string `json:"owner_id"`
|
|
|
|
|
|
Owner *UserResponse `json:"owner"`
|
|
|
|
|
|
MemberCount int `json:"member_count"`
|
|
|
|
|
|
MaxMembers int `json:"max_members"`
|
|
|
|
|
|
JoinType int `json:"join_type"`
|
|
|
|
|
|
MuteAll bool `json:"mute_all"`
|
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
|
PostCount int64 `json:"post_count"`
|
|
|
|
|
|
Announcement *GroupAnnouncementResponse `json:"announcement,omitempty"`
|
|
|
|
|
|
IsPublic bool `json:"is_public"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
UpdatedAt string `json:"updated_at"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminGroupMemberResponse 管理端群组成员响应
|
|
|
|
|
|
type AdminGroupMemberResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
UserID string `json:"user_id"`
|
|
|
|
|
|
Username string `json:"username"`
|
|
|
|
|
|
Nickname string `json:"nickname"`
|
|
|
|
|
|
Avatar string `json:"avatar"`
|
|
|
|
|
|
Role string `json:"role"`
|
|
|
|
|
|
Muted bool `json:"muted"`
|
|
|
|
|
|
JoinedAt string `json:"joined_at"`
|
|
|
|
|
|
User *UserResponse `json:"user,omitempty"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminGroupMemberListResponse 管理端群组成员列表响应
|
|
|
|
|
|
type AdminGroupMemberListResponse struct {
|
|
|
|
|
|
List []*AdminGroupMemberResponse `json:"list"`
|
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
|
Page int `json:"page"`
|
|
|
|
|
|
PageSize int `json:"page_size"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminUpdateGroupStatusRequest 更新群组状态请求
|
|
|
|
|
|
type AdminUpdateGroupStatusRequest struct {
|
|
|
|
|
|
Status string `json:"status" binding:"required,oneof=active dissolved"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminTransferGroupOwnerRequest 转让群主请求
|
|
|
|
|
|
type AdminTransferGroupOwnerRequest struct {
|
|
|
|
|
|
NewOwnerID string `json:"new_owner_id" binding:"required"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Admin Dashboard DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// DashboardStatsResponse 仪表盘统计数据响应
|
|
|
|
|
|
type DashboardStatsResponse struct {
|
|
|
|
|
|
TotalUsers int64 `json:"total_users"` // 总用户数
|
|
|
|
|
|
TodayNewUsers int64 `json:"today_new_users"` // 今日新增用户
|
|
|
|
|
|
ActiveUsersToday int64 `json:"active_users_today"` // 今日活跃用户 (DAU)
|
|
|
|
|
|
ActiveUsersWeek int64 `json:"active_users_week"` // 本周活跃用户 (WAU)
|
|
|
|
|
|
ActiveUsersMonth int64 `json:"active_users_month"` // 本月活跃用户 (MAU)
|
|
|
|
|
|
Retention1Day int64 `json:"retention_1_day"` // 次日留存率 (百分比 0-100)
|
|
|
|
|
|
Retention7Day int64 `json:"retention_7_day"` // 7日留存率 (百分比 0-100)
|
|
|
|
|
|
Retention30Day int64 `json:"retention_30_day"` // 30日留存率 (百分比 0-100)
|
|
|
|
|
|
TotalPosts int64 `json:"total_posts"` // 总帖子数
|
|
|
|
|
|
TodayPosts int64 `json:"today_posts"` // 今日帖子数
|
|
|
|
|
|
PendingPosts int64 `json:"pending_posts"` // 待审核帖子数
|
|
|
|
|
|
TotalComments int64 `json:"total_comments"` // 总评论数
|
|
|
|
|
|
TodayComments int64 `json:"today_comments"` // 今日评论数
|
|
|
|
|
|
TotalGroups int64 `json:"total_groups"` // 总群组数
|
|
|
|
|
|
TodayNewGroups int64 `json:"today_new_groups"` // 今日新建群组
|
|
|
|
|
|
PendingReview int64 `json:"pending_review"` // 待审核总数
|
|
|
|
|
|
PendingPostsCount int64 `json:"pending_posts_count"` // 待审核帖子数
|
|
|
|
|
|
PendingComments int64 `json:"pending_comments_count"` // 待审核评论数
|
2026-04-15 11:50:47 +08:00
|
|
|
|
PendingAvatars int64 `json:"pending_avatars"` // 待审核头像数
|
|
|
|
|
|
PendingCovers int64 `json:"pending_covers"` // 待审核背景图数
|
|
|
|
|
|
PendingBios int64 `json:"pending_bios"` // 待审核签名数
|
2026-03-14 18:01:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UserActivityTrendResponse 用户活跃度趋势响应
|
|
|
|
|
|
type UserActivityTrendResponse struct {
|
|
|
|
|
|
Date string `json:"date"` // 日期
|
|
|
|
|
|
NewUsers int64 `json:"new_users"` // 新增用户数
|
|
|
|
|
|
ActiveUsers int64 `json:"active_users"` // 活跃用户数
|
|
|
|
|
|
Posts int64 `json:"posts"` // 帖子数
|
|
|
|
|
|
Comments int64 `json:"comments"` // 评论数
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ContentStatsResponse 内容统计响应
|
|
|
|
|
|
type ContentStatsResponse struct {
|
|
|
|
|
|
ContentDistribution []ContentDistributionItem `json:"content_distribution"` // 内容分布
|
|
|
|
|
|
PostStatusDistribution []PostStatusDistributionItem `json:"post_status_distribution"` // 帖子状态分布
|
|
|
|
|
|
UserGrowth []UserGrowthItem `json:"user_growth"` // 用户增长趋势
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ContentDistributionItem 内容分布项
|
|
|
|
|
|
type ContentDistributionItem struct {
|
|
|
|
|
|
Type string `json:"type"` // 类型:posts, comments, groups
|
|
|
|
|
|
Name string `json:"name"` // 名称
|
|
|
|
|
|
Count int64 `json:"count"` // 数量
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PostStatusDistributionItem 帖子状态分布项
|
|
|
|
|
|
type PostStatusDistributionItem struct {
|
|
|
|
|
|
Status string `json:"status"` // 状态
|
|
|
|
|
|
Name string `json:"name"` // 名称
|
|
|
|
|
|
Count int64 `json:"count"` // 数量
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UserGrowthItem 用户增长项
|
|
|
|
|
|
type UserGrowthItem struct {
|
|
|
|
|
|
Date string `json:"date"` // 日期
|
|
|
|
|
|
NewUsers int64 `json:"new_users"` // 新增用户数
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PendingContentResponse 待审核内容响应
|
|
|
|
|
|
type PendingContentResponse struct {
|
|
|
|
|
|
ID string `json:"id"` // 内容ID
|
|
|
|
|
|
Type string `json:"type"` // 内容类型(post/comment)
|
|
|
|
|
|
Title string `json:"title"` // 标题(帖子有,评论可能为空)
|
|
|
|
|
|
Content string `json:"content"` // 内容
|
|
|
|
|
|
Author *PendingContentAuthor `json:"author"` // 作者信息
|
|
|
|
|
|
CreatedAt string `json:"created_at"` // 创建时间
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PendingContentAuthor 待审核内容作者信息
|
|
|
|
|
|
type PendingContentAuthor struct {
|
|
|
|
|
|
ID string `json:"id"` // 用户ID
|
|
|
|
|
|
Username string `json:"username"` // 用户名
|
|
|
|
|
|
Nickname string `json:"nickname"` // 昵称
|
|
|
|
|
|
Avatar string `json:"avatar"` // 头像
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// OnlineUsersResponse 在线用户数响应
|
|
|
|
|
|
type OnlineUsersResponse struct {
|
|
|
|
|
|
Count int64 `json:"count"` // 在线用户数
|
|
|
|
|
|
}
|
feat(api): add cursor-based pagination for posts, comments, messages, groups, and notifications
Implement cursor-based pagination across multiple API endpoints to improve performance and enable efficient infinite scrolling. This replaces traditional offset-based pagination for high-volume data retrieval.
Changes:
- Add cursor pagination DTOs for all entity types (Post, Comment, Message, Conversation, Group, Notification, GroupMember, GroupAnnouncement)
- Implement cursor pagination methods in repositories with support for various sort orders (created_at, updated_at, join_time, seq)
- Add cursor pagination handlers that maintain backward compatibility with existing offset pagination
- Add new API routes for cursor-based endpoints (/cursor suffix)
- Add helper converter functions for pointer slice types in DTO conversions
2026-03-20 23:03:23 +08:00
|
|
|
|
|
|
|
|
|
|
// ==================== Cursor Pagination DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// CursorPageRequest 游标分页请求
|
|
|
|
|
|
type CursorPageRequest struct {
|
|
|
|
|
|
Cursor string `json:"cursor" form:"cursor"` // 游标(首次请求为空)
|
|
|
|
|
|
Direction string `json:"direction" form:"direction"` // forward | backward
|
|
|
|
|
|
PageSize int `json:"page_size" form:"page_size"` // 每页数量
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CursorPageResponse 游标分页响应(泛型版本)
|
2026-03-30 04:49:35 +08:00
|
|
|
|
// 注意:由于 Go 的限制,这里使用 any 作为 Items 类型
|
feat(api): add cursor-based pagination for posts, comments, messages, groups, and notifications
Implement cursor-based pagination across multiple API endpoints to improve performance and enable efficient infinite scrolling. This replaces traditional offset-based pagination for high-volume data retrieval.
Changes:
- Add cursor pagination DTOs for all entity types (Post, Comment, Message, Conversation, Group, Notification, GroupMember, GroupAnnouncement)
- Implement cursor pagination methods in repositories with support for various sort orders (created_at, updated_at, join_time, seq)
- Add cursor pagination handlers that maintain backward compatibility with existing offset pagination
- Add new API routes for cursor-based endpoints (/cursor suffix)
- Add helper converter functions for pointer slice types in DTO conversions
2026-03-20 23:03:23 +08:00
|
|
|
|
// 实际使用时可以创建特定类型的响应结构体
|
|
|
|
|
|
type CursorPageResponse struct {
|
2026-03-30 04:49:35 +08:00
|
|
|
|
Items any `json:"list"`
|
|
|
|
|
|
NextCursor string `json:"next_cursor,omitempty"` // 下一页游标
|
|
|
|
|
|
PrevCursor string `json:"prev_cursor,omitempty"` // 上一页游标(可选)
|
|
|
|
|
|
HasMore bool `json:"has_more"` // 是否有更多数据
|
feat(api): add cursor-based pagination for posts, comments, messages, groups, and notifications
Implement cursor-based pagination across multiple API endpoints to improve performance and enable efficient infinite scrolling. This replaces traditional offset-based pagination for high-volume data retrieval.
Changes:
- Add cursor pagination DTOs for all entity types (Post, Comment, Message, Conversation, Group, Notification, GroupMember, GroupAnnouncement)
- Implement cursor pagination methods in repositories with support for various sort orders (created_at, updated_at, join_time, seq)
- Add cursor pagination handlers that maintain backward compatibility with existing offset pagination
- Add new API routes for cursor-based endpoints (/cursor suffix)
- Add helper converter functions for pointer slice types in DTO conversions
2026-03-20 23:03:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CursorPageMeta 分页元信息
|
|
|
|
|
|
type CursorPageMeta struct {
|
|
|
|
|
|
PageSize int `json:"page_size"`
|
|
|
|
|
|
Direction string `json:"direction"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PostCursorPageResponse 帖子游标分页响应
|
|
|
|
|
|
type PostCursorPageResponse struct {
|
2026-03-23 01:06:41 +08:00
|
|
|
|
Items []*PostResponse `json:"list"`
|
feat(api): add cursor-based pagination for posts, comments, messages, groups, and notifications
Implement cursor-based pagination across multiple API endpoints to improve performance and enable efficient infinite scrolling. This replaces traditional offset-based pagination for high-volume data retrieval.
Changes:
- Add cursor pagination DTOs for all entity types (Post, Comment, Message, Conversation, Group, Notification, GroupMember, GroupAnnouncement)
- Implement cursor pagination methods in repositories with support for various sort orders (created_at, updated_at, join_time, seq)
- Add cursor pagination handlers that maintain backward compatibility with existing offset pagination
- Add new API routes for cursor-based endpoints (/cursor suffix)
- Add helper converter functions for pointer slice types in DTO conversions
2026-03-20 23:03:23 +08:00
|
|
|
|
NextCursor string `json:"next_cursor,omitempty"`
|
|
|
|
|
|
PrevCursor string `json:"prev_cursor,omitempty"`
|
|
|
|
|
|
HasMore bool `json:"has_more"`
|
2026-04-25 11:25:43 +08:00
|
|
|
|
IsBlocked bool `json:"is_blocked,omitempty"`
|
feat(api): add cursor-based pagination for posts, comments, messages, groups, and notifications
Implement cursor-based pagination across multiple API endpoints to improve performance and enable efficient infinite scrolling. This replaces traditional offset-based pagination for high-volume data retrieval.
Changes:
- Add cursor pagination DTOs for all entity types (Post, Comment, Message, Conversation, Group, Notification, GroupMember, GroupAnnouncement)
- Implement cursor pagination methods in repositories with support for various sort orders (created_at, updated_at, join_time, seq)
- Add cursor pagination handlers that maintain backward compatibility with existing offset pagination
- Add new API routes for cursor-based endpoints (/cursor suffix)
- Add helper converter functions for pointer slice types in DTO conversions
2026-03-20 23:03:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CommentCursorPageResponse 评论游标分页响应
|
|
|
|
|
|
type CommentCursorPageResponse struct {
|
2026-03-23 01:06:41 +08:00
|
|
|
|
Items []*CommentResponse `json:"list"`
|
feat(api): add cursor-based pagination for posts, comments, messages, groups, and notifications
Implement cursor-based pagination across multiple API endpoints to improve performance and enable efficient infinite scrolling. This replaces traditional offset-based pagination for high-volume data retrieval.
Changes:
- Add cursor pagination DTOs for all entity types (Post, Comment, Message, Conversation, Group, Notification, GroupMember, GroupAnnouncement)
- Implement cursor pagination methods in repositories with support for various sort orders (created_at, updated_at, join_time, seq)
- Add cursor pagination handlers that maintain backward compatibility with existing offset pagination
- Add new API routes for cursor-based endpoints (/cursor suffix)
- Add helper converter functions for pointer slice types in DTO conversions
2026-03-20 23:03:23 +08:00
|
|
|
|
NextCursor string `json:"next_cursor,omitempty"`
|
|
|
|
|
|
PrevCursor string `json:"prev_cursor,omitempty"`
|
|
|
|
|
|
HasMore bool `json:"has_more"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MessageCursorPageResponse 消息游标分页响应
|
|
|
|
|
|
type MessageCursorPageResponse struct {
|
2026-03-23 01:06:41 +08:00
|
|
|
|
Items []*MessageResponse `json:"list"`
|
feat(api): add cursor-based pagination for posts, comments, messages, groups, and notifications
Implement cursor-based pagination across multiple API endpoints to improve performance and enable efficient infinite scrolling. This replaces traditional offset-based pagination for high-volume data retrieval.
Changes:
- Add cursor pagination DTOs for all entity types (Post, Comment, Message, Conversation, Group, Notification, GroupMember, GroupAnnouncement)
- Implement cursor pagination methods in repositories with support for various sort orders (created_at, updated_at, join_time, seq)
- Add cursor pagination handlers that maintain backward compatibility with existing offset pagination
- Add new API routes for cursor-based endpoints (/cursor suffix)
- Add helper converter functions for pointer slice types in DTO conversions
2026-03-20 23:03:23 +08:00
|
|
|
|
NextCursor string `json:"next_cursor,omitempty"`
|
|
|
|
|
|
PrevCursor string `json:"prev_cursor,omitempty"`
|
|
|
|
|
|
HasMore bool `json:"has_more"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ConversationCursorPageResponse 会话游标分页响应
|
|
|
|
|
|
type ConversationCursorPageResponse struct {
|
2026-03-23 01:06:41 +08:00
|
|
|
|
Items []*ConversationResponse `json:"list"`
|
feat(api): add cursor-based pagination for posts, comments, messages, groups, and notifications
Implement cursor-based pagination across multiple API endpoints to improve performance and enable efficient infinite scrolling. This replaces traditional offset-based pagination for high-volume data retrieval.
Changes:
- Add cursor pagination DTOs for all entity types (Post, Comment, Message, Conversation, Group, Notification, GroupMember, GroupAnnouncement)
- Implement cursor pagination methods in repositories with support for various sort orders (created_at, updated_at, join_time, seq)
- Add cursor pagination handlers that maintain backward compatibility with existing offset pagination
- Add new API routes for cursor-based endpoints (/cursor suffix)
- Add helper converter functions for pointer slice types in DTO conversions
2026-03-20 23:03:23 +08:00
|
|
|
|
NextCursor string `json:"next_cursor,omitempty"`
|
|
|
|
|
|
PrevCursor string `json:"prev_cursor,omitempty"`
|
|
|
|
|
|
HasMore bool `json:"has_more"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GroupCursorPageResponse 群组游标分页响应
|
|
|
|
|
|
type GroupCursorPageResponse struct {
|
2026-03-23 01:06:41 +08:00
|
|
|
|
Items []*GroupResponse `json:"list"`
|
feat(api): add cursor-based pagination for posts, comments, messages, groups, and notifications
Implement cursor-based pagination across multiple API endpoints to improve performance and enable efficient infinite scrolling. This replaces traditional offset-based pagination for high-volume data retrieval.
Changes:
- Add cursor pagination DTOs for all entity types (Post, Comment, Message, Conversation, Group, Notification, GroupMember, GroupAnnouncement)
- Implement cursor pagination methods in repositories with support for various sort orders (created_at, updated_at, join_time, seq)
- Add cursor pagination handlers that maintain backward compatibility with existing offset pagination
- Add new API routes for cursor-based endpoints (/cursor suffix)
- Add helper converter functions for pointer slice types in DTO conversions
2026-03-20 23:03:23 +08:00
|
|
|
|
NextCursor string `json:"next_cursor,omitempty"`
|
|
|
|
|
|
PrevCursor string `json:"prev_cursor,omitempty"`
|
|
|
|
|
|
HasMore bool `json:"has_more"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// NotificationCursorPageResponse 通知游标分页响应
|
|
|
|
|
|
type NotificationCursorPageResponse struct {
|
2026-03-23 01:06:41 +08:00
|
|
|
|
Items []*NotificationResponse `json:"list"`
|
feat(api): add cursor-based pagination for posts, comments, messages, groups, and notifications
Implement cursor-based pagination across multiple API endpoints to improve performance and enable efficient infinite scrolling. This replaces traditional offset-based pagination for high-volume data retrieval.
Changes:
- Add cursor pagination DTOs for all entity types (Post, Comment, Message, Conversation, Group, Notification, GroupMember, GroupAnnouncement)
- Implement cursor pagination methods in repositories with support for various sort orders (created_at, updated_at, join_time, seq)
- Add cursor pagination handlers that maintain backward compatibility with existing offset pagination
- Add new API routes for cursor-based endpoints (/cursor suffix)
- Add helper converter functions for pointer slice types in DTO conversions
2026-03-20 23:03:23 +08:00
|
|
|
|
NextCursor string `json:"next_cursor,omitempty"`
|
|
|
|
|
|
PrevCursor string `json:"prev_cursor,omitempty"`
|
|
|
|
|
|
HasMore bool `json:"has_more"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GroupMemberCursorPageResponse 群成员游标分页响应
|
|
|
|
|
|
type GroupMemberCursorPageResponse struct {
|
2026-03-23 01:06:41 +08:00
|
|
|
|
Items []*GroupMemberResponse `json:"list"`
|
feat(api): add cursor-based pagination for posts, comments, messages, groups, and notifications
Implement cursor-based pagination across multiple API endpoints to improve performance and enable efficient infinite scrolling. This replaces traditional offset-based pagination for high-volume data retrieval.
Changes:
- Add cursor pagination DTOs for all entity types (Post, Comment, Message, Conversation, Group, Notification, GroupMember, GroupAnnouncement)
- Implement cursor pagination methods in repositories with support for various sort orders (created_at, updated_at, join_time, seq)
- Add cursor pagination handlers that maintain backward compatibility with existing offset pagination
- Add new API routes for cursor-based endpoints (/cursor suffix)
- Add helper converter functions for pointer slice types in DTO conversions
2026-03-20 23:03:23 +08:00
|
|
|
|
NextCursor string `json:"next_cursor,omitempty"`
|
|
|
|
|
|
PrevCursor string `json:"prev_cursor,omitempty"`
|
|
|
|
|
|
HasMore bool `json:"has_more"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GroupAnnouncementCursorPageResponse 群公告游标分页响应
|
|
|
|
|
|
type GroupAnnouncementCursorPageResponse struct {
|
2026-03-23 01:06:41 +08:00
|
|
|
|
Items []*GroupAnnouncementResponse `json:"list"`
|
feat(api): add cursor-based pagination for posts, comments, messages, groups, and notifications
Implement cursor-based pagination across multiple API endpoints to improve performance and enable efficient infinite scrolling. This replaces traditional offset-based pagination for high-volume data retrieval.
Changes:
- Add cursor pagination DTOs for all entity types (Post, Comment, Message, Conversation, Group, Notification, GroupMember, GroupAnnouncement)
- Implement cursor pagination methods in repositories with support for various sort orders (created_at, updated_at, join_time, seq)
- Add cursor pagination handlers that maintain backward compatibility with existing offset pagination
- Add new API routes for cursor-based endpoints (/cursor suffix)
- Add helper converter functions for pointer slice types in DTO conversions
2026-03-20 23:03:23 +08:00
|
|
|
|
NextCursor string `json:"next_cursor,omitempty"`
|
|
|
|
|
|
PrevCursor string `json:"prev_cursor,omitempty"`
|
|
|
|
|
|
HasMore bool `json:"has_more"`
|
|
|
|
|
|
}
|
2026-04-05 20:27:03 +08:00
|
|
|
|
|
|
|
|
|
|
// ==================== Verification DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// VerificationStatus 审核状态
|
|
|
|
|
|
type VerificationStatusDTO string
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
VerificationStatusNotSubmittedDTO VerificationStatusDTO = "not_submitted"
|
|
|
|
|
|
VerificationStatusPendingDTO VerificationStatusDTO = "pending"
|
|
|
|
|
|
VerificationStatusApprovedDTO VerificationStatusDTO = "approved"
|
|
|
|
|
|
VerificationStatusRejectedDTO VerificationStatusDTO = "rejected"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// UserIdentityDTO 用户身份类型
|
|
|
|
|
|
type UserIdentityDTO string
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
UserIdentityGeneralDTO UserIdentityDTO = "general"
|
|
|
|
|
|
UserIdentityStudentDTO UserIdentityDTO = "student"
|
|
|
|
|
|
UserIdentityTeacherDTO UserIdentityDTO = "teacher"
|
|
|
|
|
|
UserIdentityStaffDTO UserIdentityDTO = "staff"
|
|
|
|
|
|
UserIdentityAlumniDTO UserIdentityDTO = "alumni"
|
|
|
|
|
|
UserIdentityExternalDTO UserIdentityDTO = "external"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// SubmitVerificationRequest 提交认证申请请求
|
|
|
|
|
|
type SubmitVerificationRequest struct {
|
|
|
|
|
|
Identity UserIdentityDTO `json:"identity" binding:"required,oneof=student teacher staff alumni"`
|
|
|
|
|
|
RealName string `json:"real_name" binding:"required,max=100"`
|
|
|
|
|
|
StudentID string `json:"student_id" binding:"omitempty,max=50"`
|
|
|
|
|
|
EmployeeID string `json:"employee_id" binding:"omitempty,max=50"`
|
|
|
|
|
|
Department string `json:"department" binding:"omitempty,max=200"`
|
|
|
|
|
|
ProofMaterials string `json:"proof_materials" binding:"required"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// VerificationRecordResponse 认证记录响应
|
|
|
|
|
|
type VerificationRecordResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
UserID string `json:"user_id"`
|
|
|
|
|
|
Identity string `json:"identity"`
|
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
|
RealName string `json:"real_name"`
|
|
|
|
|
|
StudentID string `json:"student_id,omitempty"`
|
|
|
|
|
|
EmployeeID string `json:"employee_id,omitempty"`
|
|
|
|
|
|
Department string `json:"department,omitempty"`
|
|
|
|
|
|
ProofMaterials string `json:"proof_materials"`
|
|
|
|
|
|
ReviewedAt string `json:"reviewed_at,omitempty"`
|
|
|
|
|
|
ReviewedBy string `json:"reviewed_by,omitempty"`
|
|
|
|
|
|
RejectReason string `json:"reject_reason,omitempty"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
UpdatedAt string `json:"updated_at"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// VerificationStatusResponse 认证状态响应
|
|
|
|
|
|
type VerificationStatusResponse struct {
|
|
|
|
|
|
Identity string `json:"identity"`
|
|
|
|
|
|
VerificationStatus string `json:"verification_status"`
|
|
|
|
|
|
HasPendingRequest bool `json:"has_pending_request"`
|
|
|
|
|
|
LatestRecord *VerificationRecordResponse `json:"latest_record,omitempty"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminVerificationListRequest 管理端认证列表请求
|
|
|
|
|
|
type AdminVerificationListRequest struct {
|
|
|
|
|
|
Page int `form:"page" binding:"omitempty,min=1"`
|
|
|
|
|
|
PageSize int `form:"page_size" binding:"omitempty,min=1,max=100"`
|
|
|
|
|
|
Status string `form:"status" binding:"omitempty,oneof=pending approved rejected"`
|
|
|
|
|
|
Keyword string `form:"keyword" binding:"omitempty,max=100"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminVerificationListResponse 管理端认证列表响应
|
|
|
|
|
|
type AdminVerificationListResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
UserID string `json:"user_id"`
|
|
|
|
|
|
Username string `json:"username"`
|
|
|
|
|
|
Nickname string `json:"nickname"`
|
|
|
|
|
|
Avatar string `json:"avatar"`
|
|
|
|
|
|
Identity string `json:"identity"`
|
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
|
RealName string `json:"real_name"`
|
|
|
|
|
|
StudentID string `json:"student_id,omitempty"`
|
|
|
|
|
|
EmployeeID string `json:"employee_id,omitempty"`
|
|
|
|
|
|
Department string `json:"department,omitempty"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
ReviewedAt string `json:"reviewed_at,omitempty"`
|
|
|
|
|
|
ReviewerName string `json:"reviewer_name,omitempty"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminVerificationDetailResponse 管理端认证详情响应
|
|
|
|
|
|
type AdminVerificationDetailResponse struct {
|
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
|
UserID string `json:"user_id"`
|
|
|
|
|
|
Username string `json:"username"`
|
|
|
|
|
|
Nickname string `json:"nickname"`
|
|
|
|
|
|
Avatar string `json:"avatar"`
|
|
|
|
|
|
Identity string `json:"identity"`
|
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
|
RealName string `json:"real_name"`
|
|
|
|
|
|
StudentID string `json:"student_id,omitempty"`
|
|
|
|
|
|
EmployeeID string `json:"employee_id,omitempty"`
|
|
|
|
|
|
Department string `json:"department,omitempty"`
|
|
|
|
|
|
ProofMaterials string `json:"proof_materials"`
|
|
|
|
|
|
CreatedAt string `json:"created_at"`
|
|
|
|
|
|
ReviewedAt string `json:"reviewed_at,omitempty"`
|
|
|
|
|
|
ReviewedBy string `json:"reviewed_by,omitempty"`
|
|
|
|
|
|
ReviewerName string `json:"reviewer_name,omitempty"`
|
|
|
|
|
|
RejectReason string `json:"reject_reason,omitempty"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AdminReviewVerificationRequest 管理端审核认证请求
|
|
|
|
|
|
type AdminReviewVerificationRequest struct {
|
2026-04-10 01:13:58 +08:00
|
|
|
|
Approve bool `json:"approve"`
|
2026-04-05 20:27:03 +08:00
|
|
|
|
RejectReason string `json:"reject_reason" binding:"omitempty,max=500"`
|
|
|
|
|
|
}
|
2026-04-08 14:55:50 +08:00
|
|
|
|
|
|
|
|
|
|
// ==================== Privacy & Account Deletion DTOs ====================
|
|
|
|
|
|
|
|
|
|
|
|
// PrivacySettingsRequest 隐私设置请求
|
|
|
|
|
|
type PrivacySettingsRequest struct {
|
|
|
|
|
|
FollowersVisibility *string `json:"followers_visibility" binding:"omitempty,oneof=everyone following self"`
|
|
|
|
|
|
FollowingVisibility *string `json:"following_visibility" binding:"omitempty,oneof=everyone following self"`
|
|
|
|
|
|
PostsVisibility *string `json:"posts_visibility" binding:"omitempty,oneof=everyone following self"`
|
|
|
|
|
|
FavoritesVisibility *string `json:"favorites_visibility" binding:"omitempty,oneof=everyone following self"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PrivacySettingsResponse 隐私设置响应
|
|
|
|
|
|
type PrivacySettingsResponse struct {
|
|
|
|
|
|
FollowersVisibility string `json:"followers_visibility"`
|
|
|
|
|
|
FollowingVisibility string `json:"following_visibility"`
|
|
|
|
|
|
PostsVisibility string `json:"posts_visibility"`
|
|
|
|
|
|
FavoritesVisibility string `json:"favorites_visibility"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// RequestDeletionRequest 申请注销请求
|
|
|
|
|
|
type RequestDeletionRequest struct {
|
|
|
|
|
|
Password string `json:"password" binding:"required"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// DeletionStatusResponse 注销状态响应
|
|
|
|
|
|
type DeletionStatusResponse struct {
|
|
|
|
|
|
IsPendingDeletion bool `json:"is_pending_deletion"`
|
|
|
|
|
|
DeletionRequestedAt string `json:"deletion_requested_at,omitempty"`
|
|
|
|
|
|
CoolDownDays int `json:"cool_down_days,omitempty"`
|
|
|
|
|
|
}
|