Commit 312d652f by hcy001

更新自营属性

parent 672be618
...@@ -2,7 +2,6 @@ package service ...@@ -2,7 +2,6 @@ package service
import ( import (
"encoding/json" "encoding/json"
"fmt"
"github.com/iancoleman/orderedmap" "github.com/iancoleman/orderedmap"
"go_sku_server/pkg/logger" "go_sku_server/pkg/logger"
"go_sku_server/pkg/mongo" "go_sku_server/pkg/mongo"
...@@ -24,7 +23,7 @@ func (ls *LyService) GetSpuAttr(spuId string) (attrsResult interface{}) { ...@@ -24,7 +23,7 @@ func (ls *LyService) GetSpuAttr(spuId string) (attrsResult interface{}) {
if err != nil && err != mgo.ErrNotFound { if err != nil && err != mgo.ErrNotFound {
logger.Select("sku_query").Error(err.Error()) logger.Select("sku_query").Error(err.Error())
} }
fmt.Println(spuAttr.AttrsExtend) //fmt.Println(spuAttr.AttrsExtend)
//如果有attrs_extend,就去取attrs_extend //如果有attrs_extend,就去取attrs_extend
if len(spuAttr.AttrsExtend) != 0 { if len(spuAttr.AttrsExtend) != 0 {
return spuAttr.AttrsExtend return spuAttr.AttrsExtend
......
...@@ -161,7 +161,7 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan ...@@ -161,7 +161,7 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//} //}
var TagService TagsService var TagService TagsService
sku.GoodsTag = TagService.GetTags(sku.GoodsId) sku.GoodsTag = TagService.GetTags(sku.GoodsId,0)
//用spuInfo补全信息 //用spuInfo补全信息
sku = ls.CombineSup(sku, spu) sku = ls.CombineSup(sku, spu)
......
...@@ -18,7 +18,7 @@ type TagsService struct { ...@@ -18,7 +18,7 @@ type TagsService struct {
const TagZiyingSku = 4 const TagZiyingSku = 4
//获取Spu的属性 //获取Spu的属性
func (ts *TagsService) GetTags(skuId string) (goodsTags model.GoodsTag) { func (ts *TagsService) GetTags(skuId string,self_supplier_type int64) (goodsTags model.GoodsTag) {
redisCon := gredis.Conn("default_r") redisCon := gredis.Conn("default_r")
defer redisCon.Close() defer redisCon.Close()
goodsTagsStr, _ := redis.String(redisCon.Do("HGET", "goods_tag", skuId)) goodsTagsStr, _ := redis.String(redisCon.Do("HGET", "goods_tag", skuId))
...@@ -41,7 +41,7 @@ func (ts *TagsService) GetTags(skuId string) (goodsTags model.GoodsTag) { ...@@ -41,7 +41,7 @@ func (ts *TagsService) GetTags(skuId string) (goodsTags model.GoodsTag) {
} }
} }
//如果是自营商品Id,就写死当天发货标签 //如果是自营商品Id,就写死当天发货标签
if len(skuId) < 10 { if len(skuId) < 10 && self_supplier_type == 1 {
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])
......
...@@ -291,7 +291,7 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context, goodsIds []string, ch c ...@@ -291,7 +291,7 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context, goodsIds []string, ch c
//获取标签信息 //获取标签信息
var tagService TagsService var tagService TagsService
A.Set("goods_tag", tagService.GetTags(goodsId)) A.Set("goods_tag", tagService.GetTags(goodsId,gjson.Get(info, "self_supplier_type").Int()))
//最后写入sync map //最后写入sync map
(GoodsRes).Store(goodsId, A) (GoodsRes).Store(goodsId, A)
......
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