From e14e32ecc734941d9ebb7957be5cac1946fbea08 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 31 Aug 2022 09:42:38 +0800 Subject: [PATCH] =?UTF-8?q?add=20reverse:for=20v1.0.3=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tik_tok/md_tik_tok_activity.go | 7 ++++ tik_tok/svc_tik_tok_convert.go | 17 ++++++++- tik_tok/svc_tik_tok_team.go | 65 ++++++++++++++++++++++++++++++++++ tik_tok/tik_tok_test.go | 2 +- 4 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 tik_tok/md_tik_tok_activity.go create mode 100644 tik_tok/svc_tik_tok_team.go diff --git a/tik_tok/md_tik_tok_activity.go b/tik_tok/md_tik_tok_activity.go new file mode 100644 index 0000000..e829d47 --- /dev/null +++ b/tik_tok/md_tik_tok_activity.go @@ -0,0 +1,7 @@ +package tik_tok + +type TikTokActivity struct { + ActivityId string `json:"activity_id"` + ActivityName string `json:"activity_name"` + ActivityEndTime string `json:"activity_end_time"` +} diff --git a/tik_tok/svc_tik_tok_convert.go b/tik_tok/svc_tik_tok_convert.go index 4c656f3..8abcbf6 100644 --- a/tik_tok/svc_tik_tok_convert.go +++ b/tik_tok/svc_tik_tok_convert.go @@ -20,7 +20,6 @@ func GoodsCreatePid(args map[string]string) map[string]string { return data } func GoodsConvertUrl(args map[string]string) map[string]string { - params := map[string]interface{}{"pid": args["pid"], "external_info": args["external_info"], "product_url": args["product_url"]} send, err := Send(args["appkey"], args["appSecret"], "buyin.kolProductShare", params, args["acctoken"]) fmt.Println(send) @@ -61,3 +60,19 @@ func LiveConvertUrl(args map[string]string) map[string]string { return data } + +func RegimentalConvertUrl(args map[string]string) map[string]string { + + params := map[string]interface{}{"pid_info": map[string]interface{}{"pid": args["pid"], "external_info": args["external_info"]}, "open_id": args["open_id"]} + send, err := Send(args["appkey"], args["appSecret"], "buyin.instituteLiveShare", params, args["acctoken"]) + fmt.Println(send) + var data = map[string]string{} + if err != nil { + return data + } + data["deeplink"] = gjson.Get(send, "data.dy_deeplink").String() + data["content"] = php2go.Base64Encode(gjson.Get(send, "data.dy_password").String()) + data["qr_code"] = gjson.Get(send, "data.qr_code.url").String() + + return data +} diff --git a/tik_tok/svc_tik_tok_team.go b/tik_tok/svc_tik_tok_team.go new file mode 100644 index 0000000..b42d4f5 --- /dev/null +++ b/tik_tok/svc_tik_tok_team.go @@ -0,0 +1,65 @@ +package tik_tok + +import ( + "encoding/json" + "fmt" + "github.com/tidwall/gjson" +) + +func Activity(args map[string]string) []TikTokActivity { + //args = map[string]string{ + // "appkey": "7136155008692651560", + // "appSecret": "b132549f-f62c-491e-86f1-89af3658896a", + // "status": "5", + // "search_type": "0", + // "sort_type": "1", + // "page": "1", + // "page_size": "20", + // "acctoken": "21af5cb7-6a14-455f-90f7-6807b5e6655f", + //} + params := map[string]interface{}{"status": args["status"], "search_type": args["search_type"], "sort_type": args["sort_type"], "page": args["page"], "page_size": args["page_size"]} + send, err := Send(args["appkey"], args["appSecret"], "alliance.instituteColonelActivityList", params, args["acctoken"]) + var goodsList = make([]TikTokActivity, 0) + if err != nil { + return goodsList + } + product := gjson.Get(send, "data.activity_list").String() + if err != nil || product == "" { + return goodsList + } + err = json.Unmarshal([]byte(product), &goodsList) + if err != nil { + return goodsList + } + return goodsList + +} +func ActivityProduct(args map[string]string) { + //args = map[string]string{ + // "appkey": "7136155008692651560", + // "appSecret": "b132549f-f62c-491e-86f1-89af3658896a", + // "activity_id": "349895", + // "search_type": "0", + // "sort_type": "1", + // "page": "1", + // "count": "20", + // "acctoken": "21af5cb7-6a14-455f-90f7-6807b5e6655f", + //} + params := map[string]interface{}{"activity_id": args["activity_id"], "search_type": args["search_type"], "sort_type": args["sort_type"], "page": args["page"], "count": args["count"]} + send, err := Send(args["appkey"], args["appSecret"], "alliance.colonelActivityProduct", params, args["acctoken"]) + fmt.Println(send) + fmt.Println(err) +} +func ProductUrl(args map[string]string) { + //args = map[string]string{ + // "appkey": "7136155008692651560", + // "appSecret": "b132549f-f62c-491e-86f1-89af3658896a", + // "product_url": "https://haohuo.jinritemai.com/views/product/detail?id=3566782589740130047&ins_activity_param=jXxRyGL&pick_source=jc2e3jF", + // "pick_extra": "123", + // "acctoken": "21af5cb7-6a14-455f-90f7-6807b5e6655f", + //} + params := map[string]interface{}{"product_url": args["product_url"], "pick_extra": args["pick_extra"]} + send, err := Send(args["appkey"], args["appSecret"], "buyin.instPickSourceConvert", params, args["acctoken"]) + fmt.Println(send) + fmt.Println(err) +} diff --git a/tik_tok/tik_tok_test.go b/tik_tok/tik_tok_test.go index 5404527..021eea9 100644 --- a/tik_tok/tik_tok_test.go +++ b/tik_tok/tik_tok_test.go @@ -5,5 +5,5 @@ import ( ) func TestGoods(t *testing.T) { - GoodsOrder(map[string]string{}) + Activity(map[string]string{}) }