Commit 9e181fb6 by huangchengyi

1.0

parent aaa2c2e1
Showing with 25 additions and 11 deletions
......@@ -73,10 +73,20 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context,goodsIds []string, ch ch
if other_attrs == "" {
A.Set("other_attrs","")
}else{
A.Set("other_attrs",map[string]string{
"length":gjson.Get(other_attrs,"length").String(),
"gross_wegiht":gjson.Get(other_attrs,"gross_wegiht").String(),
})
B := make(map[string]string)
pick_type := gjson.Get(other_attrs,"pick_type").String()
length := gjson.Get(other_attrs,"length").String()
gross_wegiht := gjson.Get(other_attrs,"gross_wegiht").String()
if pick_type != "" {
B["pick_type"] = pick_type
}
if length != "" {
B["length"] = length
}
if gross_wegiht != "" {
B["gross_wegiht"] = gross_wegiht
}
A.Set("other_attrs",B)
}
class_id1 := gjson.Get(info, "class_id1").Int()
......@@ -114,11 +124,18 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context,goodsIds []string, ch ch
A.Set("mpl", gjson.Get(info, "mpl").Int()) //
//处理库存
lockStock := qs.skuLockNum(&redisConn,goods_id) //当前锁库库存
dbStock := gjson.Get(info, "stock").Int() //当前db库存
stock := dbStock-lockStock //当前可购买库存
A.Set("stock",stock)
if dbStock > 0 {
lockStock := qs.skuLockNum(&redisConn,goods_id) //当前锁库库存
stockG := dbStock-lockStock //当前可购买库存
if stockG >0 {
A.Set("actual_stock", gjson.Get(info, "actual_stock").Int()) //锁定库存
A.Set("stock",dbStock)
}else{
A.Set("stock",0)
}
A.Set("saler_atio", "") //
}
if len(attrs) == 0 {
A.Set("attrs", "") //属性值
......@@ -192,10 +209,7 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context,goodsIds []string, ch ch
}
A.Set("scm_brand_name", gjson.Get(info, "scm_brand_name").String()) //
A.Set("actual_stock", gjson.Get(info, "actual_stock").Int()) //
A.Set("ac_type", gjson.Get(info, "ac_type").Int()) //
A.Set("saler_atio", gjson.Get(info, "saler_atio").String()) //
//处理活动价
A.Set("ac_type",0)
......
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