diff --git a/tik_tok/svc_tik_tok_goods.go b/tik_tok/svc_tik_tok_goods.go index 6847946..ebd9247 100644 --- a/tik_tok/svc_tik_tok_goods.go +++ b/tik_tok/svc_tik_tok_goods.go @@ -80,11 +80,7 @@ func GoodsList(args map[string]string) []TikTokGoods { //详情 func GetDetail(args map[string]string) TikTokGoods { - productIds := strings.Split(args["id"], ",") - if len(productIds) == 0 { - return TikTokGoods{} - } - params := map[string]interface{}{"product_ids": productIds, "with_share_status": true} + params := map[string]interface{}{"product_ids": []string{args["id"]}, "with_share_status": true} send, err := Send(args["appkey"], args["appSecret"], "alliance.materialsProductsDetails", params, args["acctoken"]) var goodsList = TikTokGoods{} product := gjson.Get(send, "data.products").String() @@ -109,6 +105,36 @@ func GetDetail(args map[string]string) TikTokGoods { // return goodsList } + +//详情 +func GetDetailMore(args map[string]string) *[]TikTokGoods { + productIds := strings.Split(args["id"], ",") + if len(productIds) == 0 { + return nil + } + params := map[string]interface{}{"product_ids": productIds, "with_share_status": true} + send, err := Send(args["appkey"], args["appSecret"], "alliance.materialsProductsDetails", params, args["acctoken"]) + var goodsList = make([]TikTokGoods, 0) + product := gjson.Get(send, "data.products").String() + if err != nil || product == "" { + return nil + } + var lmData struct { + Data struct { + Products []TikTokGoodsLm `json:"products"` + } `json:"data"` + } + err = json.Unmarshal([]byte(send), &lmData) + if err != nil { + return nil + } + for _, v := range lmData.Data.Products { + tmp := CommGoodsDetail(v) + goodsList = append(goodsList, tmp) + } + // + return &goodsList +} func GetKlGoods(args map[string]string) TikTokGoods { content, _ := php2go.Base64Decode(args["content"]) params := map[string]interface{}{"command": content}