chore(catalog): 清理 LEWAN_ 列表过滤与商品图 UUID 历史回退
商品列表不再过滤镜像 SKU;图片只按英文 SKU 解析,修正 DLC 预设文案。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -57,9 +57,8 @@ func mapKeys(values map[string]struct{}) []string {
|
||||
func (h *MerchantHandler) ListProducts(c *gin.Context) {
|
||||
page, size := pageParams(c)
|
||||
list, total, err := h.merchantSvc.ListMerchantProductsWithOptions(middleware.GetMerchantID(c), page, size, service.ListMerchantProductsOptions{
|
||||
Status: strings.TrimSpace(c.Query("status")),
|
||||
Keyword: strings.TrimSpace(c.Query("keyword")),
|
||||
ExcludeLegacyLewanSKU: true, // LEWAN_* 镜像已废弃,列表永不返回
|
||||
Status: strings.TrimSpace(c.Query("status")),
|
||||
Keyword: strings.TrimSpace(c.Query("keyword")),
|
||||
})
|
||||
if err != nil {
|
||||
if err.Error() == "无效的商品状态" {
|
||||
|
||||
@@ -84,10 +84,9 @@ func (s *MerchantService) CreateMerchantProduct(merchantID uint, in CreateMercha
|
||||
}
|
||||
|
||||
type ListMerchantProductsOptions struct {
|
||||
ActiveOnly bool
|
||||
ExcludeLegacyLewanSKU bool
|
||||
Status string // active / inactive;空表示不限(ActiveOnly 优先)
|
||||
Keyword string
|
||||
ActiveOnly bool
|
||||
Status string // active / inactive;空表示不限(ActiveOnly 优先)
|
||||
Keyword string
|
||||
}
|
||||
|
||||
func (s *MerchantService) ListMerchantProducts(merchantID uint, page, size int, activeOnly bool) ([]model.MerchantProduct, int64, error) {
|
||||
@@ -96,11 +95,10 @@ func (s *MerchantService) ListMerchantProducts(merchantID uint, page, size int,
|
||||
})
|
||||
}
|
||||
|
||||
// ListMerchantProductsForClient 商户开放 API / 手工下单选品:排除 LEWAN_* 镜像,只返回英文主 sku。
|
||||
// ListMerchantProductsForClient 商户开放 API / 手工下单选品:只返回在售英文主 sku。
|
||||
func (s *MerchantService) ListMerchantProductsForClient(merchantID uint, page, size int) ([]model.MerchantProduct, int64, error) {
|
||||
return s.ListMerchantProductsWithOptions(merchantID, page, size, ListMerchantProductsOptions{
|
||||
ActiveOnly: true,
|
||||
ExcludeLegacyLewanSKU: true,
|
||||
ActiveOnly: true,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -116,9 +114,6 @@ func (s *MerchantService) ListMerchantProductsWithOptions(merchantID uint, page,
|
||||
}
|
||||
tx = tx.Where("status = ?", status)
|
||||
}
|
||||
if opts.ExcludeLegacyLewanSKU {
|
||||
tx = tx.Where("sku NOT ILIKE ?", "lewan_%")
|
||||
}
|
||||
if keyword := strings.TrimSpace(opts.Keyword); keyword != "" {
|
||||
like := "%" + keyword + "%"
|
||||
tx = tx.Where("(sku ILIKE ? OR display_name ILIKE ?)", like, like)
|
||||
|
||||
Reference in New Issue
Block a user