update
This commit is contained in:
@ -5,8 +5,6 @@
|
||||
// 于后端代码(不再 import 后端 internal 包),双方仅通过「签名 + JSON 载荷」契约通信。
|
||||
package ingest
|
||||
|
||||
import "strings"
|
||||
|
||||
// 入库类型(与后台 dto 保持一致)。
|
||||
const (
|
||||
KindRunway = "runway" // 走秀(默认,需 brand_uid)
|
||||
@ -26,6 +24,7 @@ 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 用)
|
||||
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(全部视为主图)。
|
||||
@ -38,37 +37,4 @@ type RunwayLook struct {
|
||||
Details []string `json:"details"` // 细节图原始 URL 列表
|
||||
}
|
||||
|
||||
// ParseCollection 从 Vogue 标题推导 collection_type 与 season,供后台补 season_code。
|
||||
//
|
||||
// "Fall 2024 Ready-to-Wear" -> ("rtw", "fall")
|
||||
// "Spring 2025 Menswear" -> ("menswear", "spring")
|
||||
// "Resort 2024" -> ("resort", "")
|
||||
// "Pre-Fall 2024" -> ("pre_fall", "")
|
||||
// "Couture Fall 2024" -> ("couture", "fall")
|
||||
func ParseCollection(title string) (collectionType, season string) {
|
||||
t := strings.ToLower(title)
|
||||
switch {
|
||||
case strings.Contains(t, "resort"):
|
||||
collectionType = "resort"
|
||||
case strings.Contains(t, "pre-fall"), strings.Contains(t, "pre fall"):
|
||||
collectionType = "pre_fall"
|
||||
case strings.Contains(t, "couture"):
|
||||
collectionType = "couture"
|
||||
case strings.Contains(t, "menswear"), strings.Contains(t, "men's"):
|
||||
collectionType = "menswear"
|
||||
case strings.Contains(t, "ready"):
|
||||
collectionType = "rtw"
|
||||
default:
|
||||
// 仅出现 spring/fall 而无明确品类词时,回落为 rtw(绝大多数季场秀)
|
||||
if strings.Contains(t, "spring") || strings.Contains(t, "fall") {
|
||||
collectionType = "rtw"
|
||||
}
|
||||
}
|
||||
switch {
|
||||
case strings.Contains(t, "spring"):
|
||||
season = "spring"
|
||||
case strings.Contains(t, "fall"):
|
||||
season = "fall"
|
||||
}
|
||||
return collectionType, season
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user