Commit 9a9e4eae by mushishixian

属性开关

parent 312d652f
Showing with 11 additions and 2 deletions
package service
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/gogf/gf/util/gconv"
"github.com/gomodule/redigo/redis"
......@@ -35,6 +36,7 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
redisConn.Close()
}()
fast := ctx.Request.FormValue("power[fast]")
showAttr := ctx.Request.FormValue("show_attr")
//批量获取商品详情
skuArr := gredis.Hmget("default_r", "sku", goodsIds)
//为了性能着想,这边也先去批量获取spu的信息
......@@ -82,16 +84,23 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
brandId := gjson.Get(spu, "brand_id").Int()
brandName, _ := redis.String(redisConn.Do("HGET", "brand", brandId))
sku.BrandName = brandName
fmt.Println(showAttr)
//获取税务信息
if fast != "1" { //仅提供价格和库存
if sku.GoodsName != "" && brandId != 0 {
sku.ErpTax = ls.GetErpTax(sku.GoodsName, brandName)
}
sku.SupplierName = ls.GetPoolSupplierName(sku.SupplierId)
if showAttr == "1" {
//获取属性
sku.Attrs = ls.GetSpuAttr(sku.SpuId)
}
if sku.Attrs == nil {
sku.Attrs = []interface{}{}
}
}
//获取供应链标准品牌
//什么是供应链的标准品牌 供应链那边报关的时候要求他们的标准品牌,所以要吧自己的品牌映射上去
......@@ -161,7 +170,7 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//}
var TagService TagsService
sku.GoodsTag = TagService.GetTags(sku.GoodsId,0)
sku.GoodsTag = TagService.GetTags(sku.GoodsId, 0)
//用spuInfo补全信息
sku = ls.CombineSup(sku, spu)
......
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