From 4626cc94c2cc96d58185cc40b88da0091bfe8e50 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 30 Jan 2024 17:13:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=96=E9=9F=B3=E7=A9=BF=E5=B1=B1=E7=94=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- csjplatform/activity.go | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/csjplatform/activity.go b/csjplatform/activity.go index e1af1d0..4363a83 100644 --- a/csjplatform/activity.go +++ b/csjplatform/activity.go @@ -2,9 +2,11 @@ package csjplatform import ( "fmt" + "github.com/syyongx/php2go" + "github.com/tidwall/gjson" ) -func Activity(args map[string]string) (string, error) { +func Activity(args map[string]string) (map[string]string, string) { params := map[string]interface{}{ "external_info": args["external_info"], "material_id": args["material_id"], @@ -14,7 +16,19 @@ func Activity(args map[string]string) (string, error) { } send, err := Send(args["app_id"], args["app_secret"], "aggregate/h5", params) - fmt.Println(send) - fmt.Println(err) - return send, err + var data = map[string]string{} + if err != nil { + fmt.Println("抖音信息=====", send) + + return data, err.Error() + } + if gjson.Get(send, "code").Int() != 10000 { + fmt.Println("抖音信息=====", send) + + 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, "" }