This commit is contained in:
toom1996
2026-09-13 00:52:35 +08:00
parent 10d8a96e8c
commit dbee704c95
44 changed files with 755 additions and 1148 deletions

View File

@ -66,10 +66,26 @@ func (q ArticleQuery) Offset() int { return (q.Page - 1) * q.Size }
//
// ID 是图片自身的编码 id(hashid,i=走秀单图 / j=街拍单图),供「单图收藏」定位到具体某一张;
// 此前只有 image + name,前端无法稳定标识单张图片,故补充该字段。
//
// Image 与 Thumb 的关系:
// - Image 是「该接口场景下的主用地址」——详情接口给展示样式(high),列表接口直接给缩略图(thumb,
// 列表只需小图,不给大图以免浪费带宽)。
// - Thumb 恒为缩略图地址(thumb 样式),**仅详情接口填充**:详情返回的是展示样式大图,
// 但大图灯箱左栏缩略图条 / 右下角细节缩略图只要几十到一百多像素,用大图纯属浪费,
// 故额外给出 Thumb 供这些「小尺寸场景」使用。列表接口不填(其 Image 本身就是缩略图)。
type PublicArticleImage struct {
ID string `json:"id"`
Image string `json:"image"`
Name string `json:"name"`
ID string `json:"id"`
Image string `json:"image"`
Thumb string `json:"thumb,omitempty"`
Name string `json:"name"`
IsDetail uint8 `json:"is_detail"` // 0=主图 1=细节图(详情接口 images 仅含主图;细节在 Details 分组)
LookIndex uint32 `json:"look_index"` // 细节图归属的主图序号(用于前端分组展开)
}
// RunwayLookDetails 某个主图(look)对应的细节图集合,供详情页「细节入口」按需展开。
type RunwayLookDetails struct {
LookIndex uint32 `json:"look_index"` // 主图序号(与 images 中对应主图的 look_index 一致)
Images []PublicArticleImage `json:"images"` // 该主图的细节图列表
}
// PublicArticle 对外展示用的精简文章结构(走秀列表)。
@ -90,7 +106,8 @@ type PublicArticle struct {
// PublicArticleDetail 对外只读文章详情:含正文与完整图片集,不暴露管理字段。
//
// 与列表一致,只返回前端渲染所需的字段;image_count / source_url / 各类时间季节元数据前端均不展示,已移除。
// 与列表一致,只返回前端渲染所需的字段;后台管理用的额外元数据(季节 / 年份 / 系列等)
// 见 AdminRunway,由后台列表接口单独返回。
type PublicArticleDetail struct {
UID string `json:"id"` // 编码后的文章 id(无序串)
BrandUID string `json:"brand_id"` // 编码后的品牌 id(无序串)
@ -98,8 +115,8 @@ type PublicArticleDetail struct {
Description string `json:"description"`
Cover string `json:"cover"`
BrandName string `json:"brand_name"`
SourceURL string `json:"source_url"` // 采集来源链接(后台溯源用,对外无害)
Images []PublicArticleImage `json:"images"`
Images []PublicArticleImage `json:"images"` // 仅主图(look 图),默认展示
Details []RunwayLookDetails `json:"details"` // 按主图分组的细节图(「细节入口」展开用);无细节时为空
}
// AdminRunway 后台管理用的走秀列表项:在 PublicArticle 基础上补回管理字段,
@ -114,5 +131,4 @@ type AdminRunway struct {
CollectionType string `json:"collection_type"` // rtw / menswear / couture / resort / pre_fall
SeasonCode string `json:"season_code"` // SS26 / FW25 / RES26 / PF25
ImageCount uint16 `json:"image_count"`
SourceURL string `json:"source_url"` // 采集来源链接(去重 / 溯源用)
}

View File

@ -7,17 +7,3 @@ type CrawlBrand struct {
BrandUID string `json:"brand_uid"`
Name string `json:"name"`
}
// CrawlExistsRequest 图集预检请求:一次问一批 source_url 是否已爬取过。
// 设计为批量而非逐个,是因为爬虫在拿到列表页后能一次拼出几十上百个图集链接,
// 逐个问会退化成 N 次 HTTP 往返,反而比直接抓取更慢。
type CrawlExistsRequest struct {
SourceURLs []string `json:"source_urls"`
}
// CrawlExistsResponse 图集预检响应。existing 为「已爬取过、无需再抓」的 source_url 列表;
// 未出现在其中的即认为需要抓取。
type CrawlExistsResponse struct {
Existing []string `json:"existing"` // 已爬取过的 source_url,爬虫应跳过
ExistingCount int `json:"existing_count"` // 命中数量,便于爬虫打日志观察命中率
}

View File

@ -8,13 +8,12 @@ const (
// RunwayIngest 爬虫上报的单场载荷(ingest_jobs.payload 的 JSON 结构)。
//
// 设计:爬虫只传「元数据 + 图片 source_url 列表」,不传图、不直写业务表;
// 设计:爬虫只传「元数据 + 图片 URL 列表」,不传图、不直写业务表;
// 下载与存储上传由后台 worker 完成。
//
// 通用字段:
// - Kind: runway | street(决定 worker 走哪条晋升管线;缺省 runway)
// - SourceURL: 采集来源链接(去重 / 溯源,必填)
// - Images: 图片原始 URL 列表(worker 下载)
// - Kind: runway | street(决定 worker 走哪条晋升管线;缺省 runway)
// - Images: 图片原始 URL 列表(worker 下载)
//
// runway 专属:BrandUID(品牌 hashid 编码,必填)、TitleEn/TitleCn、Description*、Year、Season、CollectionType。
// street 专属:City(地区/城市)、TitleEn(单标题)。
@ -29,6 +28,15 @@ type RunwayIngest struct {
Season string `json:"season"` // spring / fall
CollectionType string `json:"collection_type"` // rtw / menswear / couture / resort / pre_fall
City string `json:"city"` // 地区/城市(street 用)
SourceURL string `json:"source_url"` // 采集来源链接(去重 / 溯源,必填)
Images []string `json:"images"` // 图片原始 URL 列表(worker 下载)
Images []string `json:"images"` // 兼容旧 worker:铺平的主图 URL 列表(无细节分组时回退用)
// Looks 结构化「主图 + 细节图」分组(Vogue 一个 gallery item = 1 主图 + N 细节图)。
// 爬虫结构化上报时优先用 Looks;为空时 worker 回退到 Images(全部视为主图,无细节)。
Looks []RunwayLook `json:"looks,omitempty"`
}
// RunwayLook 一场秀中的一个 look:1 张主图 + 0..N 张细节图。
// 主图即对外默认展示的走秀图;细节图挂靠到对应主图,由「细节入口」按需展开。
type RunwayLook struct {
Main string `json:"main"` // 主图(look)原始 URL
Details []string `json:"details"` // 细节图原始 URL 列表
}