Browse Source

抖音穿山甲

master
huangjiajun 11 months ago
parent
commit
efd8aa1b87
1 changed files with 23 additions and 4 deletions
  1. +23
    -4
      csjplatform/goods.go

+ 23
- 4
csjplatform/goods.go View File

@@ -95,7 +95,7 @@ func GoodsList(args map[string]string) []tik_tok.TikTokGoods {
}

//商品详情接口
func GoodsDetail(args map[string]string) (string, error) {
func GoodsDetail(args map[string]string) tik_tok.TikTokGoods {

params := map[string]interface{}{}
if args["product_ids"] != "" {
@@ -107,9 +107,28 @@ func GoodsDetail(args map[string]string) (string, error) {
params["product_ids"] = ids
}
send, err := Send(args["app_id"], args["app_secret"], "product/detail", params)
fmt.Println(send)
fmt.Println(err)
return send, err
var goodsList = tik_tok.TikTokGoods{}
product := gjson.Get(send, "data.products").String()
if err != nil || product == "" {
return goodsList
}
var lmData struct {
Data struct {
Products []tik_tok.TikTokGoodsLm `json:"products"`
} `json:"data"`
}
err = json.Unmarshal([]byte(send), &lmData)
if err != nil {
return goodsList
}
for _, v := range lmData.Data.Products {
tmp := tik_tok.CommGoodsDetail(v)
if tmp.GoodsID == args["product_ids"] {
return tmp
}
}
//
return goodsList
}

//3.2.2 商品转链接口


Loading…
Cancel
Save