From 527373853e5da4c0c82b165086684fdb45886df5 Mon Sep 17 00:00:00 2001 From: lq Date: Mon, 1 Dec 2025 10:56:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=98=AF=E5=90=A6=E9=89=B4?= =?UTF-8?q?=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/BaseApp/BaseClient.php | 23 ++++++++++------------- app/BaseApp/BaseService.php | 2 +- 2 files changed, 11 insertions(+), 14 deletions(-) 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() {