From b3e73651e5e8b1b2e2b7da60e1bb6fc2f5d0ffc2 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 6 May 2024 17:49:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A9=BF=E5=B1=B1=E7=94=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tik_tok/goods.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tik_tok/goods.go b/tik_tok/goods.go index 00aff13..b793bdd 100644 --- a/tik_tok/goods.go +++ b/tik_tok/goods.go @@ -131,6 +131,40 @@ func CsjpGoodsDetail(args map[string]string) TikTokGoods { // return goodsList } +func CsjpGoodsDetailMore(args map[string]string) []TikTokGoods { + + params := map[string]interface{}{} + if args["product_ids"] != "" { + ex := strings.Split(args["product_ids"], ",") + ids := make([]int, 0) + for _, v := range ex { + ids = append(ids, zhios_third_party_utils.StrToInt(v)) + } + params["product_ids"] = ids + } + send, err := CsjpSend(args["app_id"], args["app_secret"], "product/detail", params) + var goodsList = make([]TikTokGoods, 0) + product := gjson.Get(send, "data.products").String() + if err != nil || product == "" { + return goodsList + } + var lmData struct { + Data struct { + Products []TikTokGoodsLm `json:"products"` + } `json:"data"` + } + err = json.Unmarshal([]byte(send), &lmData) + if err != nil { + return goodsList + } + for _, v := range lmData.Data.Products { + v.CosRatio = v.CosRatio / 100 + tmp := CommGoodsDetail(v) + goodsList = append(goodsList, tmp) + } + // + return goodsList +} //3.2.2 商品转链接口 func CsjpGoodsLink(args map[string]string) (string, error) {