是否鉴权
This commit is contained in:
@@ -89,12 +89,18 @@ class BaseService
|
|||||||
* @var string 时间字段
|
* @var string 时间字段
|
||||||
*/
|
*/
|
||||||
protected string $timeField = 'created_at';
|
protected string $timeField = 'created_at';
|
||||||
|
/**
|
||||||
|
* @var bool 是否鉴权
|
||||||
|
*/
|
||||||
|
private $auth = true;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->userInfo = JWTService::getInstance()->getToken()->getUserInfo();
|
if ($this->auth === true) {
|
||||||
$this->userId = $this->userInfo['id'] ?? 0;
|
$this->userInfo = JWTService::getInstance()->getToken()->getUserInfo();
|
||||||
$this->roleId = $this->userInfo['role_id'] ?? 0;
|
$this->userId = $this->userInfo['id'] ?? 0;
|
||||||
|
$this->roleId = $this->userInfo['role_id'] ?? 0;
|
||||||
|
}
|
||||||
$this->utils = UtilsService::getInstance();
|
$this->utils = UtilsService::getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user