优化是否鉴权
This commit is contained in:
@@ -7,25 +7,22 @@ use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
|
||||
class BaseClient
|
||||
class BaseClient extends BaseService
|
||||
{
|
||||
private static mixed $_instance;
|
||||
|
||||
|
||||
/**
|
||||
* 获取实例
|
||||
* @return null|static
|
||||
*/
|
||||
public static function getInstance(): null|static
|
||||
protected $client;
|
||||
|
||||
protected string $baseUrl = '';
|
||||
protected array $headers = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$name = get_called_class();
|
||||
if (!isset(self::$_instance[$name])) {
|
||||
self::$_instance[$name] = new static();
|
||||
}
|
||||
|
||||
return self::$_instance[$name];
|
||||
$this->isAuth = false;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化请求类
|
||||
* @return $this
|
||||
|
||||
@@ -92,7 +92,7 @@ class BaseService
|
||||
/**
|
||||
* @var bool 是否鉴权
|
||||
*/
|
||||
private $isAuth = true;
|
||||
protected $isAuth = true;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user