This commit is contained in:
toom1996
2026-09-03 00:32:52 +08:00
parent 1fd9c48f58
commit ffe84efc4c
9 changed files with 143 additions and 39 deletions

View File

@ -2,23 +2,40 @@ package dto
// ---------- 收藏 ----------
// 收藏粒度:与 model.Favorite.Kind 对应。
const (
FavoriteKindGallery = "gallery" // 整篇图集(runway / street)
FavoriteKindImage = "image" // 单张图片(runway_image / snap_image)
)
// FavoriteItem 对外返回的收藏项:id 即 target_uid,便于前端直接比对卡片 id。
//
// kind=image 时 image_url 是这一张图、parent_uid 是所属图集,前端用这两项渲染与回跳;
// kind=gallery 时沿用 cover / title / brand 快照。
type FavoriteItem struct {
ID string `json:"id"`
Type string `json:"type"`
Title string `json:"title"`
Cover string `json:"cover"`
Brand string `json:"brand"`
AddedAt uint32 `json:"added_at"`
ID string `json:"id"`
Type string `json:"type"`
Title string `json:"title"`
Cover string `json:"cover"`
Brand string `json:"brand"`
AddedAt uint32 `json:"added_at"`
Kind string `json:"kind"`
ImageURL string `json:"image_url"`
ParentUID string `json:"parent_uid"`
}
// FavoriteAdd 添加收藏请求体。target_uid 为前端卡片的 it.id(编码串)。
// FavoriteAdd 添加收藏请求体。target_uid 为前端卡片的 id(图集或图片的编码串)。
type FavoriteAdd struct {
TargetType string `json:"target_type" binding:"required"` // runway | street
TargetType string `json:"target_type" binding:"required"` // runway | street | runway_image | snap_image
TargetUID string `json:"target_uid" binding:"required"`
Title string `json:"title"`
Cover string `json:"cover"`
Brand string `json:"brand"`
// 图片收藏可选字段。kind 留空时由 target_type 推断(*_image → image,否则 gallery)。
Kind string `json:"kind"`
ImageURL string `json:"image_url"`
ParentUID string `json:"parent_uid"`
}
// FavoriteCheck 批量查询哪些 target_uid 已收藏(列表页打勾用,与收藏总量解耦)。