diff --git a/Container.php b/Container.php index 2304b35..af0a931 100644 --- a/Container.php +++ b/Container.php @@ -48,7 +48,7 @@ class Container } /** - * @param \common\Config $config + * @param wchat\common\Config $config * @return $this */ public function generate(Config $config) diff --git a/wchat/common/HttpClient.php b/wchat/common/HttpClient.php index e19cf34..81a28e3 100644 --- a/wchat/common/HttpClient.php +++ b/wchat/common/HttpClient.php @@ -278,7 +278,7 @@ class HttpClient private function request($url, $data = []) { $data = $this->paramEncode($data); - if ($this->use_swoole && $this->isCli()) { + if ($this->use_swoole || $this->isCli()) { [$url, $host] = $this->parseUrlHost($url); return $this->coroutine($host, $url, $data); } else { diff --git a/wchat/common/Miniprogarampage.php b/wchat/common/Miniprogarampage.php index f269121..6d30447 100644 --- a/wchat/common/Miniprogarampage.php +++ b/wchat/common/Miniprogarampage.php @@ -73,9 +73,6 @@ abstract class Miniprogarampage implements Progaram */ public function __construct() { - $this->request = HttpClient::NewRequest(); - $this->request->setIsSSL(true); - $this->request->setData(null); } /** @@ -106,6 +103,9 @@ abstract class Miniprogarampage implements Progaram public function initConfig($config) { $this->config = $config; + $this->request = HttpClient::NewRequest(); + $this->request->setIsSSL(true); + $this->request->setData(null); $this->request->setUseSwoole($config->isUsrSwoole()); $this->request->setAgent($config->getAgent()); if (!empty($config->getSslCert())) { @@ -118,7 +118,7 @@ abstract class Miniprogarampage implements Progaram } /** - * @return \common\Config + * @return \wchat\common\Config */ public function getConfig() {