From a4f0d4364d76e1948a85e16c520f81b018dee3df Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 31 Mar 2023 13:56:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- md/tik_tok_goods.go | 23 +++++++++++++++++++++++ tik_tok/svc_tik_tok_goods.go | 11 +++++++++++ 2 files changed, 34 insertions(+) create mode 100644 md/tik_tok_goods.go diff --git a/md/tik_tok_goods.go b/md/tik_tok_goods.go new file mode 100644 index 0000000..9be8933 --- /dev/null +++ b/md/tik_tok_goods.go @@ -0,0 +1,23 @@ +package md + +type PicturesData struct { + BigPicture string `json:"big_picture"` + LittlePicture string `json:"little_picture"` +} +type SkusData struct { + EffectivePrice int `json:"effective_price"` + SkuId int64 `json:"sku_id"` + StockNum int `json:"stock_num"` +} +type SpecsData struct { + Name string `json:"name"` + SpecItems []struct { + Id string `json:"id"` + Name string `json:"name"` + } `json:"spec_items"` +} +type SkuData struct { + Pictures map[string]PicturesData `json:"pictures"` + Skus map[string]SkusData `json:"skus"` + Specs []SpecsData `json:"specs"` +} diff --git a/tik_tok/svc_tik_tok_goods.go b/tik_tok/svc_tik_tok_goods.go index 79aa222..fdbf124 100644 --- a/tik_tok/svc_tik_tok_goods.go +++ b/tik_tok/svc_tik_tok_goods.go @@ -1,6 +1,7 @@ package tik_tok import ( + "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/md" zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" "encoding/json" "fmt" @@ -109,6 +110,16 @@ func GetDetail(args map[string]string) TikTokGoods { // return goodsList } +func GetDetailSku(args map[string]string, id int64) md.SpecsData { + params := map[string]interface{}{"product_id": id} + send, err := Send(args["appkey"], args["appSecret"], "buyin.productSkus", params, args["acctoken"]) + var goodsList = md.SpecsData{} + product := gjson.Get(send, "data.data").String() + if err != nil || product == "" { + return goodsList + } + return goodsList +} //详情 func GetDetailMore(args map[string]string) *[]TikTokGoods {