feat: 支持人工修改蝦皮规格 (#215)

This commit is contained in:
chengma
2026-08-13 12:14:02 +08:00
parent 5b7d92289e
commit 4752fef54f
16 changed files with 403 additions and 34 deletions
+15 -15
View File
@@ -214,17 +214,16 @@ func ParseShopeeSearchField(s string) string {
// ShopeeSpecView 是弹窗规格表的一行。
type ShopeeSpecView struct {
SKUID string
Color string
Size string
Advice string
RecordID string
SKUID string
Color string
Size string
Advice string
// StatusText 是"✓"或"待补",`[必须]` 要有文字,不能只靠颜色区分(见 #41)。
StatusText string
// Pending 为 true 时模板整行标黄,并在下面加一行显示 SpecRaw 原文。
// Pending 为 true 时模板整行标黄。
Pending bool
// SpecRaw 只在 Pending 为 true 时才有意义。
// `[必须]` 待补的行必须显示规格原文——不显示的话人工不知道该填什么,
// 这正是保留 spec_raw 这个设计的全部意义,见 #41。
// SpecRaw 对所有行保持只读展示,人工编辑时用它核对颜色和尺码。
SpecRaw string
}
@@ -317,18 +316,19 @@ func GetShopeeProductDetail(db *sql.DB, goodsID string) (*ShopeeProductDetail, e
}
d.SKUs = make([]ShopeeSpecView, 0, len(skus))
for _, sk := range skus {
row := ShopeeSpecView{SKUID: sk.SKUID}
row := ShopeeSpecView{
RecordID: sk.RecordID,
SKUID: sk.SKUID,
Color: sk.Color,
Size: sk.Size,
Advice: sk.Advice,
SpecRaw: sk.SpecRaw,
}
if sk.ParseOK {
row.Color, row.Size, row.Advice = sk.Color, sk.Size, sk.Advice
if row.Advice == "" {
row.Advice = placeholder
}
row.StatusText = "✓"
} else {
row.Color, row.Size, row.Advice = placeholder, placeholder, placeholder
row.StatusText = "待补"
row.Pending = true
row.SpecRaw = sk.SpecRaw
d.PendingCount++
}
d.SKUs = append(d.SKUs, row)