ziwen 1 rok pred
rodič
commit
1bc5aba198
1 zmenil súbory, kde vykonal 7 pridanie a 5 odobranie
  1. 7 5
      services/hz_data_api.go

+ 7 - 5
services/hz_data_api.go

@@ -39,16 +39,18 @@ func HttpPost(funcName, method string, postDataMap map[string]interface{}) (resu
 		return "", err
 	}
 	req.Header.Set("content-type", "application/json")
-	utils.FileLog.Info(fmt.Sprintf("请求函数:%s ;请求体:%s", funcName, req))
+	utils.FileLog.Info(fmt.Sprintf("请求函数:%s ;请求地址:%s;请求体:%s", funcName, utils.HzDataApi+method, string(bytesData)))
 	resp, err := client.Do(req)
 	if err != nil {
 		return "", err
 	}
-	body, err := ioutil.ReadAll(resp.Body)
-	if err != nil {
-		return "", err
+	if resp.Body != nil {
+		body, err := ioutil.ReadAll(resp.Body)
+		if err != nil {
+			return "", err
+		}
+		result = string(body)
 	}
-	result = string(body)
 	utils.FileLog.Info(fmt.Sprintf("请求函数:%s ;返回体:%s", funcName, result))
 	return
 }