update
This commit is contained in:
23
internal/dto/crawl.go
Normal file
23
internal/dto/crawl.go
Normal file
@ -0,0 +1,23 @@
|
||||
package dto
|
||||
|
||||
// CrawlBrand 爬虫取任务接口返回的单个品牌。
|
||||
// brand_uid 为 hashid 编码串(与对外一致),spider 直接拿它上送 ingest,无需自己编码;
|
||||
// name 为英文品牌名,供 spider 拼接到 vogue 抓取 URL(如 /fashion-shows/designer/<slug>)。
|
||||
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"` // 命中数量,便于爬虫打日志观察命中率
|
||||
}
|
||||
34
internal/dto/ingest.go
Normal file
34
internal/dto/ingest.go
Normal file
@ -0,0 +1,34 @@
|
||||
package dto
|
||||
|
||||
// 入库类型(payload.Kind)。
|
||||
const (
|
||||
IngestKindRunway = "runway" // 走秀(默认,需 brand_uid)
|
||||
IngestKindStreet = "street" // 街拍(无品牌,需 city/title)
|
||||
)
|
||||
|
||||
// RunwayIngest 爬虫上报的单场载荷(ingest_jobs.payload 的 JSON 结构)。
|
||||
//
|
||||
// 设计:爬虫只传「元数据 + 图片 source_url 列表」,不传图、不直写业务表;
|
||||
// 下载与存储上传由后台 worker 完成。
|
||||
//
|
||||
// 通用字段:
|
||||
// - Kind: runway | street(决定 worker 走哪条晋升管线;缺省 runway)
|
||||
// - SourceURL: 采集来源链接(去重 / 溯源,必填)
|
||||
// - Images: 图片原始 URL 列表(worker 下载)
|
||||
//
|
||||
// runway 专属:BrandUID(品牌 hashid 编码,必填)、TitleEn/TitleCn、Description*、Year、Season、CollectionType。
|
||||
// street 专属:City(地区/城市)、TitleEn(单标题)。
|
||||
type RunwayIngest struct {
|
||||
Kind string `json:"kind"` // runway | street,缺省 runway
|
||||
BrandUID string `json:"brand_uid"` // 品牌编码 id(hashid),runway 必填
|
||||
TitleEn string `json:"title_en"` // 英文标题(runway 优先;street 作为单标题)
|
||||
TitleCn string `json:"title_cn"` // 中文标题(可空)
|
||||
DescriptionEn string `json:"description_en"` // 英文描述(可空)
|
||||
DescriptionCn string `json:"description_cn"` // 中文描述(可空)
|
||||
Year uint16 `json:"year"` // 年份,如 2026
|
||||
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 下载)
|
||||
}
|
||||
Reference in New Issue
Block a user