更新 Http.php
This commit is contained in:
+6
-9
@@ -27,12 +27,10 @@ class Http
|
||||
) {
|
||||
return $this->curl($url, $pushType, $data, $callback, $isSSL);
|
||||
}
|
||||
if (!extension_loaded('swoole')) {
|
||||
return $this->curl($url, $pushType, $data, $callback, $isSSL);
|
||||
} else {
|
||||
|
||||
$url = 'https://' . $this->url . '/' . $url;
|
||||
return $this->coroutine($url, $pushType, $data, $callback, $isSSL);
|
||||
}
|
||||
|
||||
return $this->curl($url, $pushType, $data, $callback, $isSSL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,7 +142,9 @@ class Http
|
||||
private function build($body, $callback, $_data)
|
||||
{
|
||||
$result = [];
|
||||
if ($callback === NULL) {
|
||||
if ($callback !== NULL) {
|
||||
return call_user_func($callback, $body, $_data);
|
||||
}
|
||||
if (is_null($results = json_decode($body, TRUE))) {
|
||||
$data = simplexml_load_string($body, 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
$results = json_decode(json_encode($data), TRUE);
|
||||
@@ -160,9 +160,6 @@ class Http
|
||||
$result['message'] = 'system success.';
|
||||
$result['data'] = $results;
|
||||
}
|
||||
} else {
|
||||
$result = call_user_func($callback, $body, $_data);
|
||||
}
|
||||
if (!is_array($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user