41 lines
2.3 KiB
Go
41 lines
2.3 KiB
Go
// Package ingest 爬虫侧入库客户端:把走秀元数据以 HMAC 签名 POST 到后台
|
||
// ingest 接口(:8092/admin/internal/ingest),替代原先直写 brand_runway 表。
|
||
//
|
||
// 与后台 internal/pkg/hmac、internal/pkg/hashid 保持同算法,使爬虫模块完全解耦
|
||
// 于后端代码(不再 import 后端 internal 包),双方仅通过「签名 + JSON 载荷」契约通信。
|
||
package ingest
|
||
|
||
// 入库类型(与后台 dto 保持一致)。
|
||
const (
|
||
KindRunway = "runway" // 走秀(默认,需 brand_uid)
|
||
KindStreet = "street" // 街拍(无品牌,需 city/title)
|
||
)
|
||
|
||
// RunwayIngest 与后台 dto.RunwayIngest 的 JSON 字段一一对应。
|
||
// 爬虫只传元数据 + 图片 URL 列表,图下载/OSS 由后台 worker 完成。
|
||
type RunwayIngest struct {
|
||
Kind string `json:"kind"` // runway | street,缺省 runway
|
||
BrandUID string `json:"brand_uid"` // 品牌 hashid(EncodeBrand 生成),runway 必填
|
||
TitleEn string `json:"title_en"` // 英文标题(优先;street 作为单标题)
|
||
TitleCn string `json:"title_cn"` // 中文标题(可空)
|
||
DescriptionEn string `json:"description_en"` // 英文描述(可空)
|
||
DescriptionCn string `json:"description_cn"` // 中文描述(可空)
|
||
Year uint16 `json:"year"` // 年份
|
||
Season string `json:"season"` // spring / fall
|
||
CollectionType string `json:"collection_type"` // rtw / menswear / couture / resort / pre_fall
|
||
City string `json:"city"` // 地区/城市(street 用)
|
||
PublishedAt uint32 `json:"published_at"` // Vogue 详情页 datePublished 的 Unix 时间戳(秒);0=未抽取。标题缺年份时用于矫正 year
|
||
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 列表
|
||
}
|
||
|
||
|