From ed92b10f96fc66887a1d0b58a94eb2cf074fd3e0 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 4 Jul 2022 14:08:22 +0800 Subject: [PATCH] =?UTF-8?q?add=20reverse:for=20v1.0.2=20=E6=9E=81=E5=85=89?= =?UTF-8?q?=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hdl/jg_push.go | 12 ++++++------ hdl/push_test.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hdl/jg_push.go b/hdl/jg_push.go index 71d36db..510a805 100644 --- a/hdl/jg_push.go +++ b/hdl/jg_push.go @@ -10,10 +10,10 @@ import ( "github.com/tidwall/gjson" ) -func Send(appKey, appSecret string, param md.PushParam) (string, error) { +func Send(appKey, appSecret string, param md.PushParam) (string, string, error) { if appKey == "" || appSecret == "" { - return "", errors.New("配置未设置") + return "", "", errors.New("配置未设置") } url := "https://api.jpush.cn/v3/push" var iosAlert = md.PushIosAlert{Title: param.Title, Body: param.Content} @@ -55,16 +55,16 @@ func Send(appKey, appSecret string, param md.PushParam) (string, error) { } b, err := json.Marshal(req) if err != nil { - return "", err + return "", "", err } res, err := jg_push_utils.CurlPost(url, b, headers) if err != nil { - return "", err + return "", "", err } fmt.Println(string(res)) msgId := gjson.Get(string(res), "msg_id").String() if msgId == "0" || msgId == "" { - return "", err + return "", string(res), err } - return msgId, nil + return msgId, string(res), nil } diff --git a/hdl/push_test.go b/hdl/push_test.go index 072c00f..92faecc 100644 --- a/hdl/push_test.go +++ b/hdl/push_test.go @@ -26,5 +26,5 @@ func TestPush(t *testing.T) { Content: "哈哈哈哈", Extras: extras, } - Send("6033fc3e19543740413d19aa", "ca7db52b63f7833299042f6a", param) + Send("6033fc3e19543740413d19aa", "ca7db52b63f7833299042f6a1", param) }