add clear
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
namespace wchat\common;
|
namespace wchat\common;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use Swoole\Coroutine;
|
use Swoole\Coroutine;
|
||||||
use Swoole\Coroutine\Http\Client as SClient;
|
use Swoole\Coroutine\Http\Client as SClient;
|
||||||
use Swoole\Coroutine\System;
|
use Swoole\Coroutine\System;
|
||||||
@@ -209,7 +208,8 @@ class HttpClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $header
|
* @param $key
|
||||||
|
* @param $value
|
||||||
*/
|
*/
|
||||||
public function setHeader($key, $value)
|
public function setHeader($key, $value)
|
||||||
{
|
{
|
||||||
@@ -486,10 +486,9 @@ class HttpClient
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $host
|
* @param $host
|
||||||
* @param $port
|
|
||||||
* @param $url
|
* @param $url
|
||||||
* @param $data
|
* @param $data
|
||||||
* @return \Swoole\Coroutine\Http\Client
|
* @return SClient
|
||||||
*/
|
*/
|
||||||
private function generate_client($host, $url, $data = [])
|
private function generate_client($host, $url, $data = [])
|
||||||
{
|
{
|
||||||
@@ -554,7 +553,7 @@ class HttpClient
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$contentType = $this->header['Content-Type'] ?? null;
|
$contentType = $this->header['Content-Type'] ?? 'application/x-www-form-urlencoded';
|
||||||
if (strpos($contentType, 'json') !== false) {
|
if (strpos($contentType, 'json') !== false) {
|
||||||
return Help::toJson($data);
|
return Help::toJson($data);
|
||||||
} else if (strpos($contentType, 'xml') !== false) {
|
} else if (strpos($contentType, 'xml') !== false) {
|
||||||
@@ -622,9 +621,6 @@ class HttpClient
|
|||||||
*/
|
*/
|
||||||
private function curlParse($url, $data)
|
private function curlParse($url, $data)
|
||||||
{
|
{
|
||||||
Log::debug('qq', [$this->createRequestUrl($url, $data), $data]);
|
|
||||||
|
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $this->createRequestUrl($url, $data));
|
curl_setopt($ch, CURLOPT_URL, $this->createRequestUrl($url, $data));
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);// 超时设置
|
curl_setopt($ch, CURLOPT_TIMEOUT, 5);// 超时设置
|
||||||
@@ -651,7 +647,6 @@ class HttpClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->method != self::GET) {
|
if ($this->method != self::GET) {
|
||||||
Log::debug('wchat', [json_decode($data, true)]);
|
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user