|
@@ -1,8 +1,11 @@ |
|
|
package csjplatform |
|
|
package csjplatform |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
|
|
|
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/tik_tok" |
|
|
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" |
|
|
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" |
|
|
|
|
|
"encoding/json" |
|
|
"fmt" |
|
|
"fmt" |
|
|
|
|
|
"github.com/tidwall/gjson" |
|
|
"strings" |
|
|
"strings" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
@@ -16,7 +19,7 @@ func GoodsCate(args map[string]string) (string, error) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//3.2.1 商品列表接口 |
|
|
//3.2.1 商品列表接口 |
|
|
func GoodsList(args map[string]string) (string, error) { |
|
|
|
|
|
|
|
|
func GoodsList(args map[string]string) []tik_tok.TikTokGoods { |
|
|
params := map[string]interface{}{ |
|
|
params := map[string]interface{}{ |
|
|
"page": zhios_third_party_utils.StrToInt(args["page"]), |
|
|
"page": zhios_third_party_utils.StrToInt(args["page"]), |
|
|
"page_size": zhios_third_party_utils.StrToInt(args["page_size"]), |
|
|
"page_size": zhios_third_party_utils.StrToInt(args["page_size"]), |
|
@@ -67,9 +70,27 @@ func GoodsList(args map[string]string) (string, error) { |
|
|
params["activity_id"] = zhios_third_party_utils.StrToInt(args["activity_id"]) |
|
|
params["activity_id"] = zhios_third_party_utils.StrToInt(args["activity_id"]) |
|
|
} |
|
|
} |
|
|
send, err := Send(args["app_id"], args["app_secret"], "product/search", params) |
|
|
send, err := Send(args["app_id"], args["app_secret"], "product/search", params) |
|
|
fmt.Println(send) |
|
|
|
|
|
fmt.Println(err) |
|
|
|
|
|
return send, err |
|
|
|
|
|
|
|
|
var goodsList = make([]tik_tok.TikTokGoods, 0) |
|
|
|
|
|
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 { |
|
|
|
|
|
fmt.Println("抖音商品1", err) |
|
|
|
|
|
|
|
|
|
|
|
return goodsList |
|
|
|
|
|
} |
|
|
|
|
|
for _, v := range lmData.Data.Products { |
|
|
|
|
|
tmp := tik_tok.CommGoodsDetail(v) |
|
|
|
|
|
goodsList = append(goodsList, tmp) |
|
|
|
|
|
} |
|
|
|
|
|
return goodsList |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//商品详情接口 |
|
|
//商品详情接口 |
|
|