From 9780ee345b51a6ee4ef710cc93e12d615a54dae4 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Thu, 9 Jan 2020 19:09:41 +0800 Subject: [PATCH] add clear --- common/HttpClient.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/HttpClient.php b/common/HttpClient.php index 2064396..b45c3a2 100644 --- a/common/HttpClient.php +++ b/common/HttpClient.php @@ -574,8 +574,13 @@ class HttpClient return $result; } - $result['code'] = $body[$this->errorCodeField] ?? 0; - $result['message'] = $body[$this->errorMsgField] ?? 'system success.'; + if (is_string($body)) { + $result['code'] = 0; + $result['message'] = ''; + } else { + $result['code'] = $body[$this->errorCodeField] ?? 0; + $result['message'] = $body[$this->errorMsgField] ?? 'system success.'; + } $result['data'] = $body; $result['header'] = $header; $result['httpStatus'] = $statusCode;