Commit 7f61b493 by 杨树贤

Merge branch 'ysx-商品标签需求-20250723' into dev

parents 74b06bad 89afc6c1
Showing with 31 additions and 0 deletions
......@@ -98,7 +98,38 @@ func (ts *TagsService) GetLyTags(sku model.LySku) (goodsTags model.GoodsTag) {
}
}
//还要判断source的标签
sourceTagsStr, _ := redis.String(redisCon.Do("HGET", "goods_source_tags", sku.Source))
if sourceTagsStr != "" {
systemTags := gjson.Get(sourceTagsStr, "system_tags").Array()
for _, tag := range systemTags {
tagNames = append(tagNames, tag.String())
}
}
//判断goods_label的标签
labelTagsStr, _ := redis.String(redisCon.Do("HGET", "goods_label_tags", sku.GoodsTag.GoodsLabel))
if labelTagsStr != "" {
labelTags := gjson.Get(labelTagsStr, "system_tags").Array()
for _, tag := range labelTags {
tagNames = append(tagNames, tag.String())
}
}
//去重tagNames
tagNames = removeDuplicateString(tagNames)
goodsTags.GoodsTagNames = tagNames
goodsTags.GoodsTag = tags
return goodsTags
}
func removeDuplicateString(s []string) []string {
result := []string{}
temp := map[string]struct{}{}
for _, item := range s {
if _, ok := temp[item]; !ok {
temp[item] = struct{}{}
result = append(result, item)
}
}
return result
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment