优化是否鉴权
Some checks failed
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled

This commit is contained in:
2025-12-01 10:56:30 +08:00
parent 120a88da30
commit 527373853e
2 changed files with 11 additions and 14 deletions

View File

@@ -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

View File

@@ -92,7 +92,7 @@ class BaseService
/**
* @var bool 是否鉴权
*/
private $isAuth = true;
protected $isAuth = true;
public function __construct()
{