add clear

This commit is contained in:
as2252258@163.com
2019-09-19 19:04:43 +08:00
parent d605600657
commit f2dc33fca4
3 changed files with 30 additions and 4 deletions
+2 -4
View File
@@ -25,11 +25,8 @@ abstract class Miniprogarampage
*/
private function __construct()
{
if (!($this->request instanceof WxClient)) {
$this->request = new WxClient();
}
$this->request = WxClient::getInstance();
$this->request->setIsSSL(true);
$this->request->setAgent($this->config->getAgent());
}
/**
@@ -42,6 +39,7 @@ abstract class Miniprogarampage
static::$instance = new static();
}
static::$instance->config = $config;
static::$instance->request->setAgent($config->getAgent());
return static::$instance;
}
+11
View File
@@ -91,4 +91,15 @@ class Wx
{
return Notify::getInstance($this->config);
}
/**
* @return WxClient
*/
public function getClient()
{
$client = WxClient::getInstance();
$client->setAgent($this->config->getAgent());
return $client;
}
}
+17
View File
@@ -23,6 +23,23 @@ class WxClient
const DELETE = 'delete';
const OPTIONS = 'option';
private static $_instance;
private function __construct()
{
}
/**
* @return WxClient
*/
public static function getInstance()
{
if (!(static::$_instance instanceof WxClient)) {
static::$_instance = new WxClient();
}
return static::$_instance;
}
/**
* @param string $host
*/