diff --git a/wchat/common/HttpClient.php b/wchat/common/HttpClient.php index fa456b8..af01af6 100644 --- a/wchat/common/HttpClient.php +++ b/wchat/common/HttpClient.php @@ -623,7 +623,7 @@ class HttpClient private function curl($url, $data = []) { try { - $output = $this->curlParse($url, $this->mergeParams($data)); + $output = $this->curlParse($url, $data); if ($output === FALSE) { return new Result(['code' => 500, 'message' => $output]); } @@ -680,9 +680,10 @@ class HttpClient if ($this->method == self::POST) { curl_setopt($ch, CURLOPT_POST, 1); } - - if ($this->method != self::GET) { + if ($this->method == self::GET || !empty($this->_data)) { curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + } else { + curl_setopt($ch, CURLOPT_POSTFIELDS, $this->mergeParams($data)); } curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($this->method));