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) }