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, "" }