From 9c28ca2744e6d561431e7a237b19333364e66ba1 Mon Sep 17 00:00:00 2001 From: lq Date: Mon, 1 Dec 2025 10:41:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=AF=E5=90=A6=E9=89=B4=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/BaseApp/BaseService.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/BaseApp/BaseService.php b/app/BaseApp/BaseService.php index 6c68d5d8..9ab31b48 100755 --- a/app/BaseApp/BaseService.php +++ b/app/BaseApp/BaseService.php @@ -89,12 +89,18 @@ class BaseService * @var string 时间字段 */ protected string $timeField = 'created_at'; + /** + * @var bool 是否鉴权 + */ + private $auth = true; public function __construct() { - $this->userInfo = JWTService::getInstance()->getToken()->getUserInfo(); - $this->userId = $this->userInfo['id'] ?? 0; - $this->roleId = $this->userInfo['role_id'] ?? 0; + if ($this->auth === true) { + $this->userInfo = JWTService::getInstance()->getToken()->getUserInfo(); + $this->userId = $this->userInfo['id'] ?? 0; + $this->roleId = $this->userInfo['role_id'] ?? 0; + } $this->utils = UtilsService::getInstance(); }