Commit 0cf52465 by mushishixian

标准品牌

parent eae0754d
...@@ -65,6 +65,7 @@ type LySku struct { ...@@ -65,6 +65,7 @@ type LySku struct {
HasGiftActivity int `json:"has_gift_activity"` HasGiftActivity int `json:"has_gift_activity"`
GiftActivity GiftActivity `json:"gift_activity"` GiftActivity GiftActivity `json:"gift_activity"`
ActivityInfo PriceActivity `json:"activity_info"` ActivityInfo PriceActivity `json:"activity_info"`
StandardBrand StandardBrand `json:"standard_brand"`
} }
type PriceActivity struct { type PriceActivity struct {
...@@ -89,6 +90,12 @@ type ActivityCommon struct { ...@@ -89,6 +90,12 @@ type ActivityCommon struct {
UserScope int `json:"user_scope,omitempty"` UserScope int `json:"user_scope,omitempty"`
} }
type StandardBrand struct {
StandardBrandId int `json:"standard_brand_id,omitempty"`
BrandName string `json:"brand_name,omitempty"`
BrandLogo string `json:"brand_logo,omitempty"`
}
//为什么不直接映射到结构,而要用gjson,因为redis存的数据结构不一定正常,可能类型不一致 //为什么不直接映射到结构,而要用gjson,因为redis存的数据结构不一定正常,可能类型不一致
func InitSkuData(sku string) (data LySku) { func InitSkuData(sku string) (data LySku) {
goodsSn := gjson.Get(sku, "goods_sn").String() goodsSn := gjson.Get(sku, "goods_sn").String()
......
...@@ -98,6 +98,9 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan ...@@ -98,6 +98,9 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//继来那边对接的标准品牌(下单的时候) //继来那边对接的标准品牌(下单的时候)
sku.ScmBrand = ls.GetScmBrand(brandId) sku.ScmBrand = ls.GetScmBrand(brandId)
//获取新版的标准品牌
sku.StandardBrand = ls.GetStandardBrand(brandId)
//处理过期 //处理过期
if gjson.Get(skuStr, "is_expire").Int() != 0 { if gjson.Get(skuStr, "is_expire").Int() != 0 {
sku.LadderPrice = nil sku.LadderPrice = nil
......
...@@ -109,6 +109,23 @@ func (ls *LyService) GetScmBrand(brandId int64) (res interface{}) { ...@@ -109,6 +109,23 @@ func (ls *LyService) GetScmBrand(brandId int64) (res interface{}) {
} }
} }
//获取新版标准品牌
func (ls *LyService) GetStandardBrand(brandId int64) (standardBrand model.StandardBrand) {
redisCon := gredis.Conn("default_r")
defer redisCon.Close()
standardBrandId, _ := redis.Int(redisCon.Do("HGET", "standard_brand_mapping", brandId))
if standardBrandId != 0 {
standardBrandStr, err := redis.String(redisCon.Do("HGET", "standard_brand", standardBrandId))
if err != nil {
logger.Select("sku_query").Error(err.Error())
}
standardBrand.BrandName = gjson.Get(standardBrandStr, "brand_name").String()
standardBrand.StandardBrandId = int(gjson.Get(standardBrandStr, "standard_brand_id").Int())
standardBrand.BrandLogo = gjson.Get(standardBrandStr, "brandLogo").String()
}
return standardBrand
}
type ExtendFee struct { type ExtendFee struct {
Cn struct { Cn struct {
Max interface{} `json:"max"` Max interface{} `json:"max"`
...@@ -323,12 +340,12 @@ func (ls *LyService) GetDelivery(supplierId int64, canal string) (delivery map[s ...@@ -323,12 +340,12 @@ func (ls *LyService) GetDelivery(supplierId int64, canal string) (delivery map[s
//为了兼容供应商修改的问题 //为了兼容供应商修改的问题
if cnDeliveryTime != "周" && cnDeliveryTime != "天" { if cnDeliveryTime != "周" && cnDeliveryTime != "天" {
delivery["cn_delivery"] = gjson.Get(supplierRatio, "cn_delivery_time").String() delivery["cn_delivery"] = gjson.Get(supplierRatio, "cn_delivery_time").String()
}else{ } else {
delivery["cn_delivery"] = "" delivery["cn_delivery"] = ""
} }
if usDeliveryTime != "周" && usDeliveryTime != "天" { if usDeliveryTime != "周" && usDeliveryTime != "天" {
delivery["hk_delivery"] = gjson.Get(supplierRatio, "us_delivery_time").String() delivery["hk_delivery"] = gjson.Get(supplierRatio, "us_delivery_time").String()
}else{ } else {
delivery["hk_delivery"] = "" delivery["hk_delivery"] = ""
} }
} }
......
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