From b8976fed7142da2a2d9cf0bab86320391a99b5f2 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 29 Sep 2022 16:07:34 +0800 Subject: [PATCH] =?UTF-8?q?Json=E8=A7=A3=E9=87=8A=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- modules/aisafety/resty.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/aisafety/resty.go b/modules/aisafety/resty.go index 868adeb91..31d66b880 100644 --- a/modules/aisafety/resty.go +++ b/modules/aisafety/resty.go @@ -38,11 +38,13 @@ type ReturnMsg struct { Data ReturnData `json:"data"` Times int64 `json:"times"` } + type ReturnData struct { ID int `json:"id"` No string `json:"no"` StandardJson string `json:"standardJson"` Code int `json:"code"` + Msg string `json:"msg"` Status int `json:"status"` } @@ -243,10 +245,10 @@ func GetTaskStatus(jobID string) (*ReturnMsg, error) { log.Info("error =" + err.Error()) return nil, fmt.Errorf("Get task status error: %v", err) } else { - var reMap *ReturnMsg - err = json.Unmarshal(res.Body(), reMap) + var reMap ReturnMsg + err = json.Unmarshal(res.Body(), &reMap) if err == nil { - return reMap, nil + return &reMap, nil } else { return nil, fmt.Errorf("get error,code not 0") }