Commit 4291b2f8 by mushishixian

fix

parent 545f3731
Showing with 5 additions and 5 deletions
...@@ -22,6 +22,9 @@ func (ts *TagsService) GetTags(skuId string) (goodsTags model.GoodsTag) { ...@@ -22,6 +22,9 @@ func (ts *TagsService) GetTags(skuId string) (goodsTags model.GoodsTag) {
redisCon := gredis.Conn("default_r") redisCon := gredis.Conn("default_r")
goodsTagsStr, _ := redis.String(redisCon.Do("HGET", "goods_tag", skuId)) goodsTagsStr, _ := redis.String(redisCon.Do("HGET", "goods_tag", skuId))
goodsLabel := "" goodsLabel := ""
//goods_tag
var tags []int
var tagNames []string
if goodsTagsStr != "" { if goodsTagsStr != "" {
//goods_label //goods_label
goodsLabelType := int(gjson.Get(goodsTagsStr, "goods_label").Int()) goodsLabelType := int(gjson.Get(goodsTagsStr, "goods_label").Int())
...@@ -30,16 +33,14 @@ func (ts *TagsService) GetTags(skuId string) (goodsTags model.GoodsTag) { ...@@ -30,16 +33,14 @@ func (ts *TagsService) GetTags(skuId string) (goodsTags model.GoodsTag) {
goodsTags.GoodsLabelName = goodsLabel goodsTags.GoodsLabelName = goodsLabel
goodsTags.GoodsLabel = goodsLabelType goodsTags.GoodsLabel = goodsLabelType
//goods_tag
var tags []int
var tagNames []string
for _, tagResult := range gjson.Get(goodsTagsStr, "tags").Array() { for _, tagResult := range gjson.Get(goodsTagsStr, "tags").Array() {
tagName := vars.GoodsTags[int(tagResult.Int())] tagName := vars.GoodsTags[int(tagResult.Int())]
tagNames = append(tagNames, tagName) tagNames = append(tagNames, tagName)
tags = append(tags, int(tagResult.Int())) tags = append(tags, int(tagResult.Int()))
} }
}
//如果是自营商品Id,就写死当天发货标签 //如果是自营商品Id,就写死当天发货标签
if len(skuId) > 10 { if len(skuId) < 10 {
if !php2go.InArray(TagZiyingSku, tags) { if !php2go.InArray(TagZiyingSku, tags) {
tags = append(tags, TagZiyingSku) tags = append(tags, TagZiyingSku)
tagNames = append(tagNames, vars.GoodsTags[TagZiyingSku]) tagNames = append(tagNames, vars.GoodsTags[TagZiyingSku])
...@@ -47,6 +48,5 @@ func (ts *TagsService) GetTags(skuId string) (goodsTags model.GoodsTag) { ...@@ -47,6 +48,5 @@ func (ts *TagsService) GetTags(skuId string) (goodsTags model.GoodsTag) {
} }
goodsTags.GoodsTagNames = tagNames goodsTags.GoodsTagNames = tagNames
goodsTags.GoodsTag = tags goodsTags.GoodsTag = tags
}
return goodsTags return goodsTags
} }
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