From a7e253a0086becc0ff7522db4c04ad57c1c0bbc5 Mon Sep 17 00:00:00 2001 From: Rogee Date: Thu, 8 Jan 2026 14:53:14 +0800 Subject: [PATCH] chore: enrich content dto comments --- backend/app/http/v1/dto/content.go | 149 +++++++++++++++++++---------- 1 file changed, 101 insertions(+), 48 deletions(-) diff --git a/backend/app/http/v1/dto/content.go b/backend/app/http/v1/dto/content.go index 697f697..7e41d76 100644 --- a/backend/app/http/v1/dto/content.go +++ b/backend/app/http/v1/dto/content.go @@ -4,94 +4,147 @@ import "quyun/v2/app/requests" type ContentListFilter struct { requests.Pagination - Keyword *string `query:"keyword"` - Genre *string `query:"genre"` - TenantID *int64 `query:"tenantId"` - Sort *string `query:"sort"` - IsPinned *bool `query:"is_pinned"` + // Keyword 关键词搜索(匹配标题/摘要/描述)。 + Keyword *string `query:"keyword"` + // Genre 内容类型/分类筛选。 + Genre *string `query:"genre"` + // TenantID 租户ID筛选(内容所属店铺)。 + TenantID *int64 `query:"tenantId"` + // Sort 排序规则(latest/hot/price_asc)。 + Sort *string `query:"sort"` + // IsPinned 置顶内容筛选(true 仅返回置顶)。 + IsPinned *bool `query:"is_pinned"` + // PriceType 价格类型筛选(free/paid)。 PriceType *string `query:"price_type"` } type ContentItem struct { + // ID 内容唯一ID。 ID int64 `json:"id"` // TenantID 内容所属租户ID。 TenantID int64 `json:"tenant_id"` // UserID 内容作者用户ID(与 author_id 同义,便于后台展示)。 - UserID int64 `json:"user_id"` - Title string `json:"title"` - Cover string `json:"cover"` - Genre string `json:"genre"` - Type string `json:"type"` // video, audio, article + UserID int64 `json:"user_id"` + // Title 内容标题。 + Title string `json:"title"` + // Cover 封面URL(无封面时为空)。 + Cover string `json:"cover"` + // Genre 内容分类/风格标签。 + Genre string `json:"genre"` + // Type 内容媒体类型(video/audio/article)。 + Type string `json:"type"` // Status 内容状态(如 published/unpublished)。 Status string `json:"status"` // Visibility 内容可见性(如 public/tenant_only/private)。 - Visibility string `json:"visibility"` - Price float64 `json:"price"` - AuthorID int64 `json:"author_id"` - AuthorName string `json:"author_name"` + Visibility string `json:"visibility"` + // Price 价格(单位元,免费为 0)。 + Price float64 `json:"price"` + // AuthorID 作者用户ID。 + AuthorID int64 `json:"author_id"` + // AuthorName 作者展示名(优先昵称)。 + AuthorName string `json:"author_name"` // AuthorAvatar 作者头像URL。 - AuthorAvatar string `json:"author_avatar"` - AuthorIsFollowing bool `json:"author_is_following"` - Views int `json:"views"` - Likes int `json:"likes"` - CreatedAt string `json:"created_at"` + AuthorAvatar string `json:"author_avatar"` + // AuthorIsFollowing 当前用户是否关注作者(未登录默认 false)。 + AuthorIsFollowing bool `json:"author_is_following"` + // Views 浏览量统计。 + Views int `json:"views"` + // Likes 点赞数统计。 + Likes int `json:"likes"` + // CreatedAt 创建时间(RFC3339 格式)。 + CreatedAt string `json:"created_at"` // PublishedAt 发布时间,未发布为空。 PublishedAt string `json:"published_at"` - IsPurchased bool `json:"is_purchased"` + // IsPurchased 是否已购买(用于内容列表快速判断)。 + IsPurchased bool `json:"is_purchased"` } type ContentDetail struct { ContentItem - Description string `json:"description"` - Body string `json:"body"` - MediaUrls []MediaURL `json:"media_urls"` - Meta Meta `json:"meta"` - IsLiked bool `json:"is_liked"` - IsFavorited bool `json:"is_favorited"` + // Description 内容描述(用于详情页摘要)。 + Description string `json:"description"` + // Body 详细正文/图文内容(文章类可为空)。 + Body string `json:"body"` + // MediaUrls 关联媒体资源(音频/视频/预览)。 + MediaUrls []MediaURL `json:"media_urls"` + // Meta 内容元信息(曲风/调性/节拍等)。 + Meta Meta `json:"meta"` + // IsLiked 当前用户是否点赞。 + IsLiked bool `json:"is_liked"` + // IsFavorited 当前用户是否收藏。 + IsFavorited bool `json:"is_favorited"` } type MediaURL struct { - Type string `json:"type"` - URL string `json:"url"` - Duration int `json:"duration"` + // Type 媒体类型(audio/video/image/preview)。 + Type string `json:"type"` + // URL 媒体资源地址。 + URL string `json:"url"` + // Duration 媒体时长(秒),无时长则为 0。 + Duration int `json:"duration"` } type Meta struct { + // Role 内容角色/定位(如 demo/主稿)。 Role string `json:"role"` - Key string `json:"key"` + // Key 音乐调性或主音。 + Key string `json:"key"` + // Beat 节拍信息(如 4/4)。 Beat string `json:"beat"` } type Comment struct { - ID int64 `json:"id"` - Content string `json:"content"` - UserID int64 `json:"user_id"` + // ID 评论ID。 + ID int64 `json:"id"` + // Content 评论内容。 + Content string `json:"content"` + // UserID 评论用户ID。 + UserID int64 `json:"user_id"` + // UserNickname 评论用户昵称。 UserNickname string `json:"user_nickname"` - UserAvatar string `json:"user_avatar"` - CreateTime string `json:"create_time"` - Likes int `json:"likes"` - IsLiked bool `json:"is_liked"` - ReplyTo int64 `json:"reply_to"` + // UserAvatar 评论用户头像。 + UserAvatar string `json:"user_avatar"` + // CreateTime 评论创建时间(RFC3339)。 + CreateTime string `json:"create_time"` + // Likes 评论点赞数。 + Likes int `json:"likes"` + // IsLiked 当前用户是否点赞该评论。 + IsLiked bool `json:"is_liked"` + // ReplyTo 回复的评论ID(0 表示一级评论)。 + ReplyTo int64 `json:"reply_to"` } type CommentCreateForm struct { + // Content 评论正文,不能为空。 Content string `json:"content"` - ReplyTo int64 `json:"reply_to"` + // ReplyTo 被回复评论ID(0 表示一级评论)。 + ReplyTo int64 `json:"reply_to"` } type Topic struct { - ID int64 `json:"id"` + // ID 专题ID。 + ID int64 `json:"id"` + // Title 专题标题。 Title string `json:"title"` + // Cover 专题封面图。 Cover string `json:"cover"` - Tag string `json:"tag"` - Count int `json:"count"` + // Tag 专题标签(用于筛选/展示)。 + Tag string `json:"tag"` + // Count 专题内内容数量。 + Count int `json:"count"` } type ContentPrice struct { - Currency string `json:"currency"` - PriceAmount float64 `json:"price_amount"` - DiscountType string `json:"discount_type"` - DiscountValue float64 `json:"discount_value"` - DiscountStartAt string `json:"discount_start_at"` - DiscountEndAt string `json:"discount_end_at"` + // Currency 币种(CNY 等)。 + Currency string `json:"currency"` + // PriceAmount 原价金额(单位元)。 + PriceAmount float64 `json:"price_amount"` + // DiscountType 折扣类型(amount/percent)。 + DiscountType string `json:"discount_type"` + // DiscountValue 折扣值(amount=元,percent=百分比)。 + DiscountValue float64 `json:"discount_value"` + // DiscountStartAt 折扣开始时间(RFC3339)。 + DiscountStartAt string `json:"discount_start_at"` + // DiscountEndAt 折扣结束时间(RFC3339)。 + DiscountEndAt string `json:"discount_end_at"` }