2019-07-17 17:17:37 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace wchat;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Wx
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/** @var static $instance */
|
|
|
|
|
private static $instance = null;
|
|
|
|
|
|
|
|
|
|
/** @var Config $config */
|
|
|
|
|
private $config = null;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return static
|
|
|
|
|
*/
|
|
|
|
|
public static function getMiniProGaRamPage()
|
|
|
|
|
{
|
|
|
|
|
if (static::$instance === null) {
|
|
|
|
|
static::$instance = new Wx();
|
|
|
|
|
}
|
|
|
|
|
return static::$instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Config
|
|
|
|
|
*/
|
|
|
|
|
public function getConfig()
|
|
|
|
|
{
|
|
|
|
|
return $this->config;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param Config $config
|
|
|
|
|
* @return $this
|
|
|
|
|
*/
|
|
|
|
|
public function setConfig(Config $config)
|
|
|
|
|
{
|
|
|
|
|
$this->config = $config;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Template
|
|
|
|
|
*/
|
|
|
|
|
public function getTemplate()
|
|
|
|
|
{
|
|
|
|
|
return Template::getInstance($this->config);
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-21 11:54:20 +08:00
|
|
|
|
|
|
|
|
/**
|
2019-08-21 11:55:42 +08:00
|
|
|
* @return PublicTemplate
|
2019-08-21 11:54:20 +08:00
|
|
|
*/
|
|
|
|
|
public function getPublicTemplate()
|
|
|
|
|
{
|
|
|
|
|
return PublicTemplate::getInstance($this->config);
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-17 17:17:37 +08:00
|
|
|
/**
|
|
|
|
|
* @return Account
|
|
|
|
|
*/
|
|
|
|
|
public function getAccount()
|
|
|
|
|
{
|
|
|
|
|
return Account::getInstance($this->config);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Message
|
|
|
|
|
*/
|
|
|
|
|
public function getMessage()
|
|
|
|
|
{
|
|
|
|
|
return Message::getInstance($this->config);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Recharge
|
|
|
|
|
*/
|
|
|
|
|
public function getRecharge()
|
|
|
|
|
{
|
|
|
|
|
return Recharge::getInstance($this->config);
|
|
|
|
|
}
|
2019-08-29 11:32:58 +08:00
|
|
|
|
|
|
|
|
/**
|
2019-08-29 14:48:09 +08:00
|
|
|
* @return Notify
|
2019-08-29 11:32:58 +08:00
|
|
|
*/
|
|
|
|
|
public function getNotify()
|
|
|
|
|
{
|
|
|
|
|
return Notify::getInstance($this->config);
|
|
|
|
|
}
|
2019-09-19 19:04:43 +08:00
|
|
|
|
2019-10-25 15:20:09 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Token
|
|
|
|
|
*/
|
|
|
|
|
public function getToken()
|
|
|
|
|
{
|
|
|
|
|
return Token::getInstance($this->config);
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-19 19:04:43 +08:00
|
|
|
/**
|
|
|
|
|
* @return WxClient
|
|
|
|
|
*/
|
|
|
|
|
public function getClient()
|
|
|
|
|
{
|
|
|
|
|
$client = WxClient::getInstance();
|
|
|
|
|
$client->setAgent($this->config->getAgent());
|
|
|
|
|
return $client;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-29 10:20:12 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Subject
|
|
|
|
|
*/
|
|
|
|
|
public function getSubject()
|
|
|
|
|
{
|
|
|
|
|
return Subject::getInstance($this->config);
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-17 17:17:37 +08:00
|
|
|
}
|