From 85fe4a9354147b893a98539284178fba5bd63279 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Wed, 26 Oct 2022 11:20:47 +0800 Subject: [PATCH] =?UTF-8?q?add=20reverse:for=20v1.1.9=20=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tik_tok/svc_tik_tok_convert.go | 36 ++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/tik_tok/svc_tik_tok_convert.go b/tik_tok/svc_tik_tok_convert.go index 47a5483..fc08424 100644 --- a/tik_tok/svc_tik_tok_convert.go +++ b/tik_tok/svc_tik_tok_convert.go @@ -19,21 +19,24 @@ func GoodsCreatePid(args map[string]string) map[string]string { data["pid"] = gjson.Get(send, "data.pid").String() return data } -func GoodsConvertUrl(args map[string]string) map[string]string { +func GoodsConvertUrl(args map[string]string) (map[string]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) var data = map[string]string{} if err != nil { - return data + return data, err.Error() + } + if gjson.Get(send, "code").Int() != 10000 { + return data, gjson.Get(send, "sub_msg").String() } 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 + return data, "" } -func ActConvertUrl(args map[string]string) map[string]string { +func ActConvertUrl(args map[string]string) (map[string]string, string) { need_qr_code := "false" if args["need_qr_code"] == "1" { need_qr_code = "true" @@ -43,13 +46,16 @@ func ActConvertUrl(args map[string]string) map[string]string { fmt.Println(send) var data = map[string]string{} if err != nil { - return data + return data, err.Error() + } + if gjson.Get(send, "code").Int() != 10000 { + return data, gjson.Get(send, "sub_msg").String() } data["deeplink"] = gjson.Get(send, "data.deep_link").String() data["content"] = php2go.Base64Encode(gjson.Get(send, "data.share_command").String()) data["qr_code"] = gjson.Get(send, "data.qrcode.url").String() - return data + return data, "" } func LiveCreatePid(args map[string]string) map[string]string { @@ -63,7 +69,7 @@ func LiveCreatePid(args map[string]string) map[string]string { data["pid"] = gjson.Get(send, "data.pid").String() return data } -func LiveConvertUrl(args map[string]string) map[string]string { +func LiveConvertUrl(args map[string]string) (map[string]string, string) { params := map[string]interface{}{"pid_info": map[string]interface{}{"pid": args["pid"], "external_info": args["external_info"]}, "buyin_id": args["open_id"]} if args["need_qr_code"] == "1" { @@ -79,27 +85,33 @@ func LiveConvertUrl(args map[string]string) map[string]string { fmt.Println(send) var data = map[string]string{} if err != nil { - return data + return data, err.Error() + } + if gjson.Get(send, "code").Int() != 10000 { + return data, gjson.Get(send, "sub_msg").String() } 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 + return data, "" } -func RegimentalConvertUrl(args map[string]string) map[string]string { +func RegimentalConvertUrl(args map[string]string) (map[string]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 + return data, err.Error() + } + if gjson.Get(send, "code").Int() != 10000 { + return data, gjson.Get(send, "sub_msg").String() } 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 + return data, "" }