longyu 2 лет назад
Родитель
Сommit
e59e1ff197
1 измененных файлов с 15 добавлено и 9 удалено
  1. 15 9
      watch/watch.go

+ 15 - 9
watch/watch.go

@@ -696,12 +696,15 @@ func postRefreshEdbData(param map[string]interface{}) (resp *BaseResponse, err e
 	if err != nil {
 		return
 	}
-	global.LOG.Info(" Refresh Result: " + string(result))
-	err = json.Unmarshal(result, &resp)
-	if err != nil {
-		return
+	if result!=nil {
+		global.LOG.Info(" Refresh Result: " + string(result))
+		err = json.Unmarshal(result, &resp)
+		if err != nil {
+			return
+		}
+		return resp, nil
 	}
-	return resp, nil
+	return nil,err
 }
 
 func HttpPost(url, postData string, params ...string) ([]byte, error) {
@@ -718,10 +721,13 @@ func HttpPost(url, postData string, params ...string) ([]byte, error) {
 	req.Header.Set("Content-Type", contentType)
 	req.Header.Set("authorization", utils.MD5(utils.APP_EDB_LIB_NAME_EN+utils.EDB_LIB_Md5_KEY))
 	resp, err := client.Do(req)
-	defer resp.Body.Close()
-	b, err := ioutil.ReadAll(resp.Body)
-	fmt.Println("HttpPost:" + string(b))
-	return b, err
+	if resp!=nil {
+		defer resp.Body.Close()
+		b, err := ioutil.ReadAll(resp.Body)
+		fmt.Println("HttpPost:" + string(b))
+		return b, err
+	}
+	return nil,err
 }
 
 /*