Commit e8253d38 by mushishixian

商品图片和pdf如果是猎芯自己oss的替换输出为https

parent a6b76238
package model package model
import ( import (
"strings"
"github.com/tidwall/gjson" "github.com/tidwall/gjson"
) )
...@@ -166,6 +168,7 @@ func InitSkuData(sku string) (data LySku) { ...@@ -166,6 +168,7 @@ func InitSkuData(sku string) (data LySku) {
data.GoodsDetails = goodsDetail data.GoodsDetails = goodsDetail
goodsImages := gjson.Get(sku, "goods_images").String() goodsImages := gjson.Get(sku, "goods_images").String()
goodsImages = strings.Replace(goodsImages, "http://img.ichunt.com", "https://img.ichunt.com", 1)
data.GoodsImages = goodsImages data.GoodsImages = goodsImages
canal := gjson.Get(sku, "canal").String() canal := gjson.Get(sku, "canal").String()
......
...@@ -5,6 +5,7 @@ import ( ...@@ -5,6 +5,7 @@ import (
"go_sku_server/pkg/gredis" "go_sku_server/pkg/gredis"
"go_sku_server/service/sorter" "go_sku_server/service/sorter"
"sort" "sort"
"strings"
"sync" "sync"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
...@@ -69,6 +70,7 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan ...@@ -69,6 +70,7 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
if pdf == "" || (php2go.Strlen(spuLargeImage) < 5) { if pdf == "" || (php2go.Strlen(spuLargeImage) < 5) {
sku.Pdf = "" sku.Pdf = ""
} else { } else {
pdf = strings.Replace(pdf, "http://img.ichunt.com", "https://img.ichunt.com", 1)
sku.Pdf = pdf sku.Pdf = pdf
} }
......
...@@ -214,9 +214,12 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context, goodsIds []string, ch c ...@@ -214,9 +214,12 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context, goodsIds []string, ch c
if img != "" { if img != "" {
goodsImages, _ = gredis.String(redisConn.Do("HGET", "Self_SelfGoodsSource", img)) goodsImages, _ = gredis.String(redisConn.Do("HGET", "Self_SelfGoodsSource", img))
} }
A.Set("goods_images", gjson.Get(goodsImages, "url").String()) image := gjson.Get(goodsImages, "url").String()
image = strings.Replace(image, "http://img.ichunt.com", "https://img.ichunt.com", 1)
A.Set("goods_images", image)
pdf := gjson.Get(info, "pdf").String() pdf := gjson.Get(info, "pdf").String()
pdf = strings.Replace(pdf, "http://img.ichunt.com", "https://img.ichunt.com", 1)
if pdf != "" { if pdf != "" {
pdf, _ = gredis.String(redisConn.Do("HGET", "Self_SelfGoodsSource", pdf)) pdf, _ = gredis.String(redisConn.Do("HGET", "Self_SelfGoodsSource", pdf))
} }
......
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