@@ -1,4 +1,4 @@ | |||
package csjplatform | |||
package tik_tok | |||
import ( | |||
"fmt" | |||
@@ -6,7 +6,7 @@ import ( | |||
"github.com/tidwall/gjson" | |||
) | |||
func Activity(args map[string]string) (map[string]string, string) { | |||
func CsjpActivity(args map[string]string) (map[string]string, string) { | |||
params := map[string]interface{}{ | |||
"external_info": args["external_info"], | |||
"material_id": args["material_id"], | |||
@@ -15,7 +15,7 @@ func Activity(args map[string]string) (map[string]string, string) { | |||
params["extra_params"] = args["extra_params"] | |||
} | |||
send, err := Send(args["app_id"], args["app_secret"], "aggregate/h5", params) | |||
send, err := CsjpSend(args["app_id"], args["app_secret"], "aggregate/h5", params) | |||
var data = map[string]string{} | |||
if err != nil { | |||
fmt.Println("抖音信息=====", send) |
@@ -1,4 +1,4 @@ | |||
package csjplatform | |||
package tik_tok | |||
import ( | |||
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/comm" | |||
@@ -9,7 +9,7 @@ import ( | |||
"time" | |||
) | |||
func Send(appkey, appSecret, method string, params map[string]interface{}) (string, error) { | |||
func CsjpSend(appkey, appSecret, method string, params map[string]interface{}) (string, error) { | |||
url := "https://ecom.pangolin-sdk-toutiao.com/" + method | |||
paramJson := comm.GetSortJson(params) | |||
paramJson = strings.ReplaceAll(paramJson, "\n", "") | |||
@@ -21,13 +21,13 @@ func Send(appkey, appSecret, method string, params map[string]interface{}) (stri | |||
"req_id": zhios_third_party_utils.UUIDString(), | |||
} | |||
sign := GetSign(appSecret, param) | |||
sign := CsjpGetSign(appSecret, param) | |||
param["sign"] = sign | |||
param["sign_type"] = "MD5" | |||
data, err := zhios_third_party_utils.CurlPost(url, zhios_third_party_utils.SerializeStr(param), nil) | |||
return string(data), err | |||
} | |||
func GetSign(secureKey string, m map[string]interface{}) string { | |||
func CsjpGetSign(secureKey string, m map[string]interface{}) string { | |||
var signStr = fmt.Sprintf("app_id=%v&data=%v&req_id=%v×tamp=%v%s", m["app_id"], m["data"], m["req_id"], m["timestamp"], secureKey) | |||
return fmt.Sprintf("%x", md5.Sum([]byte(signStr))) | |||
} |
@@ -1,7 +1,6 @@ | |||
package csjplatform | |||
package tik_tok | |||
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" | |||
"encoding/json" | |||
"fmt" | |||
@@ -10,16 +9,16 @@ import ( | |||
) | |||
//商品类目 | |||
func GoodsCate(args map[string]string) (string, error) { | |||
func CsjpGoodsCate(args map[string]string) (string, error) { | |||
params := map[string]interface{}{"parent_id": zhios_third_party_utils.StrToInt(args["parent_id"])} | |||
send, err := Send(args["app_id"], args["app_secret"], "product/category", params) | |||
send, err := CsjpSend(args["app_id"], args["app_secret"], "product/category", params) | |||
fmt.Println(send) | |||
fmt.Println(err) | |||
return send, err | |||
} | |||
//3.2.1 商品列表接口 | |||
func GoodsList(args map[string]string) []tik_tok.TikTokGoods { | |||
func CsjpGoodsList(args map[string]string) []TikTokGoods { | |||
params := map[string]interface{}{ | |||
"page": zhios_third_party_utils.StrToInt(args["page"]), | |||
"page_size": zhios_third_party_utils.StrToInt(args["page_size"]), | |||
@@ -69,16 +68,16 @@ func GoodsList(args map[string]string) []tik_tok.TikTokGoods { | |||
if 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 := CsjpSend(args["app_id"], args["app_secret"], "product/search", params) | |||
fmt.Println(send) | |||
var goodsList = make([]tik_tok.TikTokGoods, 0) | |||
var goodsList = make([]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"` | |||
Products []TikTokGoodsLm `json:"products"` | |||
} `json:"data"` | |||
} | |||
err = json.Unmarshal([]byte(send), &lmData) | |||
@@ -89,14 +88,14 @@ func GoodsList(args map[string]string) []tik_tok.TikTokGoods { | |||
} | |||
for _, v := range lmData.Data.Products { | |||
v.CosRatio = v.CosRatio / 100 | |||
tmp := tik_tok.CommGoodsDetail(v) | |||
tmp := CommGoodsDetail(v) | |||
goodsList = append(goodsList, tmp) | |||
} | |||
return goodsList | |||
} | |||
//商品详情接口 | |||
func GoodsDetail(args map[string]string) tik_tok.TikTokGoods { | |||
func CsjpGoodsDetail(args map[string]string) TikTokGoods { | |||
params := map[string]interface{}{} | |||
if args["product_ids"] != "" { | |||
@@ -107,15 +106,15 @@ func GoodsDetail(args map[string]string) tik_tok.TikTokGoods { | |||
} | |||
params["product_ids"] = ids | |||
} | |||
send, err := Send(args["app_id"], args["app_secret"], "product/detail", params) | |||
var goodsList = tik_tok.TikTokGoods{} | |||
send, err := CsjpSend(args["app_id"], args["app_secret"], "product/detail", params) | |||
var goodsList = 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"` | |||
Products []TikTokGoodsLm `json:"products"` | |||
} `json:"data"` | |||
} | |||
err = json.Unmarshal([]byte(send), &lmData) | |||
@@ -124,7 +123,7 @@ func GoodsDetail(args map[string]string) tik_tok.TikTokGoods { | |||
} | |||
for _, v := range lmData.Data.Products { | |||
v.CosRatio = v.CosRatio / 100 | |||
tmp := tik_tok.CommGoodsDetail(v) | |||
tmp := CommGoodsDetail(v) | |||
if tmp.GoodsID == args["product_ids"] { | |||
return tmp | |||
} | |||
@@ -134,7 +133,7 @@ func GoodsDetail(args map[string]string) tik_tok.TikTokGoods { | |||
} | |||
//3.2.2 商品转链接口 | |||
func GoodsLink(args map[string]string) (string, error) { | |||
func CsjpGoodsLink(args map[string]string) (string, error) { | |||
params := map[string]interface{}{ | |||
"product_url": args["product_url"], | |||
"product_ext": args["product_ext"], | |||
@@ -148,7 +147,7 @@ func GoodsLink(args map[string]string) (string, error) { | |||
} | |||
params["share_type"] = ids | |||
} | |||
send, err := Send(args["app_id"], args["app_secret"], "product/link", params) | |||
send, err := CsjpSend(args["app_id"], args["app_secret"], "product/link", params) | |||
fmt.Println(send) | |||
fmt.Println(err) | |||
return send, err |
@@ -1,7 +1,6 @@ | |||
package csjplatform | |||
package tik_tok | |||
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" | |||
"fmt" | |||
"github.com/tidwall/gjson" | |||
@@ -9,7 +8,7 @@ import ( | |||
) | |||
//抖口令解析+二次转链接口 | |||
func Keyword(args map[string]string) tik_tok.TikTokGoods { | |||
func CsjpKeyword(args map[string]string) TikTokGoods { | |||
params := map[string]interface{}{ | |||
"command": args["command"], | |||
} | |||
@@ -24,10 +23,10 @@ func Keyword(args map[string]string) tik_tok.TikTokGoods { | |||
} | |||
params["share_type"] = ids | |||
} | |||
send, err := Send(args["app_id"], args["app_secret"], "command_parse", params) | |||
send, err := CsjpSend(args["app_id"], args["app_secret"], "command_parse", params) | |||
fmt.Println(send) | |||
fmt.Println(err) | |||
var goodsList = tik_tok.TikTokGoods{} | |||
var goodsList = TikTokGoods{} | |||
ActivityId := gjson.Get(send, "data.activity_info.material_id").Int() | |||
if ActivityId > 0 { | |||
goodsList.ActivityId = zhios_third_party_utils.Int64ToStr(gjson.Get(send, "data.command_info.activity_info.material_id").Int()) | |||
@@ -38,6 +37,6 @@ func Keyword(args map[string]string) tik_tok.TikTokGoods { | |||
return goodsList | |||
} | |||
args["product_ids"] = gjson.Get(product, "product_id").String() | |||
goodsList = GoodsDetail(args) | |||
goodsList = CsjpGoodsDetail(args) | |||
return goodsList | |||
} |
@@ -1,4 +1,4 @@ | |||
package csjplatform | |||
package tik_tok | |||
import ( | |||
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" | |||
@@ -6,7 +6,7 @@ import ( | |||
"strings" | |||
) | |||
func LiveRoom(args map[string]string) (string, error) { | |||
func CsjpLiveRoom(args map[string]string) (string, error) { | |||
params := map[string]interface{}{ | |||
"page": zhios_third_party_utils.StrToInt(args["page"]), | |||
"page_size": zhios_third_party_utils.StrToInt(args["page_size"]), | |||
@@ -17,12 +17,12 @@ func LiveRoom(args map[string]string) (string, error) { | |||
if args["author_info"] != "" { | |||
params["author_info"] = args["author_info"] | |||
} | |||
send, err := Send(args["app_id"], args["app_secret"], "live/search", params) | |||
send, err := CsjpSend(args["app_id"], args["app_secret"], "live/search", params) | |||
fmt.Println(send) | |||
fmt.Println(err) | |||
return send, err | |||
} | |||
func LiveRoomLink(args map[string]string) (string, error) { | |||
func CsjpLiveRoomLink(args map[string]string) (string, error) { | |||
params := map[string]interface{}{ | |||
"author_buyin_id": args["author_buyin_id"], | |||
"external_info": args["external_info"], | |||
@@ -41,7 +41,7 @@ func LiveRoomLink(args map[string]string) (string, error) { | |||
if args["product_id"] != "" { | |||
params["product_id"] = zhios_third_party_utils.StrToInt(args["product_id"]) | |||
} | |||
send, err := Send(args["app_id"], args["app_secret"], "live/link", params) | |||
send, err := CsjpSend(args["app_id"], args["app_secret"], "live/link", params) | |||
fmt.Println(send) | |||
fmt.Println(err) | |||
return send, err |
@@ -1,4 +1,4 @@ | |||
package csjplatform | |||
package tik_tok | |||
import ( | |||
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" | |||
@@ -7,7 +7,7 @@ import ( | |||
"strings" | |||
) | |||
func OrderList(args map[string]string) map[string]interface{} { | |||
func CsjpOrderList(args map[string]string) map[string]interface{} { | |||
params := map[string]interface{}{ | |||
"size": zhios_third_party_utils.StrToInt(args["size"]), | |||
"cursor": args["cursor"], | |||
@@ -19,7 +19,7 @@ func OrderList(args map[string]string) map[string]interface{} { | |||
if args["order_ids"] != "" { | |||
params["order_ids"] = strings.Split(args["order_ids"], ",") | |||
} | |||
send, err := Send(args["app_id"], args["app_secret"], "order/search", params) | |||
send, err := CsjpSend(args["app_id"], args["app_secret"], "order/search", params) | |||
var data = map[string]interface{}{} | |||
if err != nil { | |||
return data | |||
@@ -40,7 +40,7 @@ func OrderList(args map[string]string) map[string]interface{} { | |||
} | |||
for _, v := range tmpList { | |||
tmp := CommOrder(v, statusArr, "dk") | |||
tmp := CsjpCommOrder(v, statusArr, "dk") | |||
if tmp["oid"] == "" { | |||
continue | |||
} | |||
@@ -49,7 +49,7 @@ func OrderList(args map[string]string) map[string]interface{} { | |||
data["order"] = orderTmp | |||
return data | |||
} | |||
func CommOrder(v interface{}, statusArr map[string]string, types string) map[string]string { | |||
func CsjpCommOrder(v interface{}, statusArr map[string]string, types string) map[string]string { | |||
tmp := make(map[string]string) | |||
goods := v.(map[string]interface{}) | |||
methodType := "csjp" |