feat: 增加蝦皮店铺图片筛选 (#150)

This commit is contained in:
chengma
2026-08-11 12:04:38 +08:00
parent 2a3224b86d
commit c39f5a7912
9 changed files with 212 additions and 11 deletions
+20 -1
View File
@@ -100,7 +100,7 @@ func ListShopeeProducts(db *sql.DB, filter repository.ShopeeFilter, page int) (*
Rows: make([]ShopeeProductView, 0, len(rows)),
Total: total,
HasAnyProducts: hasAny > 0,
IsFiltered: strings.TrimSpace(filter.Keyword) != "" || filter.Status != "",
IsFiltered: strings.TrimSpace(filter.Keyword) != "" || filter.Status != "" || filter.Shop != "" || filter.Image != "",
Page: page,
PageSize: PageSize,
TotalPages: totalPages,
@@ -188,6 +188,25 @@ func ShopeeStatusLabel(status string) string {
return shopeeStatusTexts[status]
}
// ShopeePresenceOptions 返回资料字段的三态选项。使用下拉框而不是复选框,
// 让“全部”和“无资料”都有明确表达,不把未勾选误解成任意状态。
func ShopeePresenceOptions(hasText, missingText string) []ShopeeStatusOption {
return []ShopeeStatusOption{
{"", "全部"},
{"has", hasText},
{"missing", missingText},
}
}
// ParseShopeePresence 校验店铺/图片筛选参数;未知值按“全部”处理。
func ParseShopeePresence(s string) string {
value := strings.TrimSpace(s)
if value == "has" || value == "missing" {
return value
}
return ""
}
// ---------- 弹窗 ----------
// ShopeeSpecView 是弹窗规格表的一行。