diff --git a/app/BaseApp/BaseClient.php b/app/BaseApp/BaseClient.php index 9f01d71e..12d1915d 100644 --- a/app/BaseApp/BaseClient.php +++ b/app/BaseApp/BaseClient.php @@ -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 diff --git a/app/BaseApp/BaseService.php b/app/BaseApp/BaseService.php index 7231732c..06785071 100755 --- a/app/BaseApp/BaseService.php +++ b/app/BaseApp/BaseService.php @@ -92,7 +92,7 @@ class BaseService /** * @var bool 是否鉴权 */ - private $isAuth = true; + protected $isAuth = true; public function __construct() {