first commit
This commit is contained in:
80
app/common/cache/AdminAccountSafeCache.php
vendored
Normal file
80
app/common/cache/AdminAccountSafeCache.php
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
|
||||
/**
|
||||
* //后台账号安全机制,连续输错后锁定,防止账号密码暴力破解
|
||||
* Class AdminAccountSafeCache
|
||||
* @package app\common\cache
|
||||
*/
|
||||
class AdminAccountSafeCache extends BaseCache
|
||||
{
|
||||
|
||||
private $key;//缓存次数名称
|
||||
public $minute = 30;//缓存设置为30分钟,即密码错误次数达到,锁定30分钟
|
||||
public $count = 5; //设置连续输错次数,即30分钟内连续输错误5次后,锁定
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$ip = \request()->ip();
|
||||
$this->key = $this->tagName . $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 记录登录错误次数
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:51
|
||||
*/
|
||||
public function record()
|
||||
{
|
||||
if ($this->get($this->key)) {
|
||||
//缓存存在,记录错误次数
|
||||
$this->inc($this->key, 1);
|
||||
} else {
|
||||
//缓存不存在,第一次设置缓存
|
||||
$this->set($this->key, 1, $this->minute * 60);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 判断是否安全
|
||||
* @return bool
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:53
|
||||
*/
|
||||
public function isSafe()
|
||||
{
|
||||
$count = $this->get($this->key);
|
||||
if ($count >= $this->count) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除该ip记录错误次数
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:55
|
||||
*/
|
||||
public function relieve()
|
||||
{
|
||||
$this->delete($this->key);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
122
app/common/cache/AdminAuthCache.php
vendored
Normal file
122
app/common/cache/AdminAuthCache.php
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
use app\adminapi\logic\auth\AuthLogic;
|
||||
|
||||
|
||||
/**
|
||||
* 管理员权限缓存
|
||||
* Class AdminAuthCache
|
||||
* @package app\common\cache
|
||||
*/
|
||||
class AdminAuthCache extends BaseCache
|
||||
{
|
||||
|
||||
private $prefix = 'admin_auth_';
|
||||
private $authConfigList = [];
|
||||
private $cacheMd5Key = ''; //权限文件MD5的key
|
||||
private $cacheAllKey = ''; //全部权限的key
|
||||
private $cacheUrlKey = ''; //管理员的url缓存key
|
||||
private $authMd5 = ''; //权限文件MD5的值
|
||||
private $adminId = '';
|
||||
|
||||
|
||||
public function __construct($adminId = '')
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->adminId = $adminId;
|
||||
// 全部权限
|
||||
$this->authConfigList = AuthLogic::getAllAuth();
|
||||
// 当前权限配置文件的md5
|
||||
$this->authMd5 = md5(json_encode($this->authConfigList));
|
||||
|
||||
$this->cacheMd5Key = $this->prefix . 'md5';
|
||||
$this->cacheAllKey = $this->prefix . 'all';
|
||||
$this->cacheUrlKey = $this->prefix . 'url_' . $this->adminId;
|
||||
|
||||
$cacheAuthMd5 = $this->get($this->cacheMd5Key);
|
||||
$cacheAuth = $this->get($this->cacheAllKey);
|
||||
//权限配置和缓存权限对比,不一样说明权限配置文件已修改,清理缓存
|
||||
if ($this->authMd5 !== $cacheAuthMd5 || empty($cacheAuth)) {
|
||||
$this->deleteTag();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取管理权限uri
|
||||
* @param $adminId
|
||||
* @return array|mixed
|
||||
* @author 令狐冲
|
||||
* @date 2021/8/19 15:27
|
||||
*/
|
||||
public function getAdminUri()
|
||||
{
|
||||
//从缓存获取,直接返回
|
||||
$urisAuth = $this->get($this->cacheUrlKey);
|
||||
if ($urisAuth) {
|
||||
return $urisAuth;
|
||||
}
|
||||
|
||||
//获取角色关联的菜单id(菜单或权限)
|
||||
$urisAuth = AuthLogic::getAuthByAdminId($this->adminId);
|
||||
if (empty($urisAuth)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$this->set($this->cacheUrlKey, $urisAuth, 3600);
|
||||
|
||||
//保存到缓存并读取返回
|
||||
return $urisAuth;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取全部权限uri
|
||||
* @return array|mixed
|
||||
* @author cjhao
|
||||
* @date 2021/9/13 11:41
|
||||
*/
|
||||
public function getAllUri()
|
||||
{
|
||||
$cacheAuth = $this->get($this->cacheAllKey);
|
||||
if ($cacheAuth) {
|
||||
return $cacheAuth;
|
||||
}
|
||||
// 获取全部权限
|
||||
$authList = AuthLogic::getAllAuth();
|
||||
//保存到缓存并读取返回
|
||||
$this->set($this->cacheMd5Key, $this->authMd5);
|
||||
$this->set($this->cacheAllKey, $authList);
|
||||
return $authList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 清理管理员缓存
|
||||
* @return bool
|
||||
* @author cjhao
|
||||
* @date 2021/10/13 18:47
|
||||
*/
|
||||
public function clearAuthCache()
|
||||
{
|
||||
$this->clear($this->cacheUrlKey);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
118
app/common/cache/AdminTokenCache.php
vendored
Normal file
118
app/common/cache/AdminTokenCache.php
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\auth\AdminSession;
|
||||
use app\common\model\auth\SystemRole;
|
||||
|
||||
/**
|
||||
* 管理员token缓存
|
||||
* Class AdminTokenCache
|
||||
* @package app\common\cache
|
||||
*/
|
||||
class AdminTokenCache extends BaseCache
|
||||
{
|
||||
|
||||
private $prefix = 'token_admin_';
|
||||
|
||||
/**
|
||||
* @notes 通过token获取缓存管理员信息
|
||||
* @param $token
|
||||
* @return false|mixed
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 16:57
|
||||
*/
|
||||
public function getAdminInfo($token)
|
||||
{
|
||||
//直接从缓存获取
|
||||
$adminInfo = $this->get($this->prefix . $token);
|
||||
if ($adminInfo) {
|
||||
return $adminInfo;
|
||||
}
|
||||
|
||||
//从数据获取信息被设置缓存(可能后台清除缓存)
|
||||
$adminInfo = $this->setAdminInfo($token);
|
||||
if ($adminInfo) {
|
||||
return $adminInfo;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 通过有效token设置管理信息缓存
|
||||
* @param $token
|
||||
* @return array|false|mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/5 12:12
|
||||
*/
|
||||
public function setAdminInfo($token)
|
||||
{
|
||||
$adminSession = AdminSession::where([['token', '=', $token], ['expire_time', '>', time()]])
|
||||
->find();
|
||||
if (empty($adminSession)) {
|
||||
return [];
|
||||
}
|
||||
$admin = Admin::where('id', '=', $adminSession->admin_id)
|
||||
->append(['role_id'])
|
||||
->find();
|
||||
|
||||
$roleName = '';
|
||||
$roleLists = SystemRole::column('name', 'id');
|
||||
if ($admin['root'] == 1) {
|
||||
$roleName = '系统管理员';
|
||||
} else {
|
||||
foreach ($admin['role_id'] as $roleId) {
|
||||
$roleName .= $roleLists[$roleId] ?? '';
|
||||
$roleName .= '/';
|
||||
}
|
||||
$roleName = trim($roleName, '/');
|
||||
}
|
||||
|
||||
$adminInfo = [
|
||||
'admin_id' => $admin->id,
|
||||
'root' => $admin->root,
|
||||
'name' => $admin->name,
|
||||
'account' => $admin->account,
|
||||
'role_name' => $roleName,
|
||||
'role_id' => $admin->role_id,
|
||||
'token' => $token,
|
||||
'terminal' => $adminSession->terminal,
|
||||
'expire_time' => $adminSession->expire_time,
|
||||
];
|
||||
$this->set($this->prefix . $token, $adminInfo, new \DateTime(Date('Y-m-d H:i:s', $adminSession->expire_time)));
|
||||
return $this->getAdminInfo($token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除缓存
|
||||
* @param $token
|
||||
* @return bool
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/3 16:57
|
||||
*/
|
||||
public function deleteAdminInfo($token)
|
||||
{
|
||||
return $this->delete($this->prefix . $token);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
68
app/common/cache/BaseCache.php
vendored
Normal file
68
app/common/cache/BaseCache.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
use think\App;
|
||||
use think\Cache;
|
||||
|
||||
/**
|
||||
* 缓存基础类,用于管理缓存
|
||||
* Class BaseCache
|
||||
* @package app\common\cache
|
||||
*/
|
||||
abstract class BaseCache extends Cache
|
||||
{
|
||||
/**
|
||||
* 缓存标签
|
||||
* @var string
|
||||
*/
|
||||
protected $tagName;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(app());
|
||||
$this->tagName = get_class($this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 重写父类set,自动打上标签
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param null $ttl
|
||||
* @return bool
|
||||
* @author 段誉
|
||||
* @date 2021/12/27 14:16
|
||||
*/
|
||||
public function set($key, $value, $ttl = null): bool
|
||||
{
|
||||
return $this->store()->tag($this->tagName)->set($key, $value, $ttl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 清除缓存类所有缓存
|
||||
* @return bool
|
||||
* @author 段誉
|
||||
* @date 2021/12/27 14:16
|
||||
*/
|
||||
public function deleteTag(): bool
|
||||
{
|
||||
return $this->tag($this->tagName)->clear();
|
||||
}
|
||||
|
||||
}
|
||||
70
app/common/cache/ExportCache.php
vendored
Normal file
70
app/common/cache/ExportCache.php
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
|
||||
|
||||
class ExportCache extends BaseCache
|
||||
{
|
||||
|
||||
protected $uniqid = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
//以微秒计的当前时间,生成一个唯一的 ID,以tagname为前缀
|
||||
$this->uniqid = md5(uniqid($this->tagName,true).mt_rand());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取excel缓存目录
|
||||
* @return string
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/28 17:36
|
||||
*/
|
||||
public function getSrc()
|
||||
{
|
||||
return app()->getRootPath() . 'runtime/file/export/'.date('Y-m').'/'.$this->uniqid.'/';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置文件路径缓存地址
|
||||
* @param $fileName
|
||||
* @return string
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/28 17:36
|
||||
*/
|
||||
public function setFile($fileName)
|
||||
{
|
||||
$src = $this->getSrc();
|
||||
$key = md5($src . $fileName) . time();
|
||||
$this->set($key, ['src' => $src, 'name' => $fileName], 300);
|
||||
return $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取文件缓存的路径
|
||||
* @param $key
|
||||
* @return mixed
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/26 18:36
|
||||
*/
|
||||
public function getFile($key)
|
||||
{
|
||||
return $this->get($key);
|
||||
}
|
||||
|
||||
}
|
||||
80
app/common/cache/UserAccountSafeCache.php
vendored
Normal file
80
app/common/cache/UserAccountSafeCache.php
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
|
||||
/**
|
||||
* //后台账号安全机制,连续输错后锁定,防止账号密码暴力破解
|
||||
* Class AdminAccountSafeCache
|
||||
* @package app\common\cache
|
||||
*/
|
||||
class UserAccountSafeCache extends BaseCache
|
||||
{
|
||||
|
||||
private $key;//缓存次数名称
|
||||
public $minute = 30;//缓存设置为15分钟,即密码错误次数达到,锁定30分钟
|
||||
public $count = 5; //设置连续输错次数,即15分钟内连续输错误5次后,锁定
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$ip = \request()->ip();
|
||||
$this->key = $this->tagName . $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 记录登录错误次数
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:51
|
||||
*/
|
||||
public function record()
|
||||
{
|
||||
if ($this->get($this->key)) {
|
||||
//缓存存在,记录错误次数
|
||||
$this->inc($this->key, 1);
|
||||
} else {
|
||||
//缓存不存在,第一次设置缓存
|
||||
$this->set($this->key, 1, $this->minute * 60);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 判断是否安全
|
||||
* @return bool
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:53
|
||||
*/
|
||||
public function isSafe()
|
||||
{
|
||||
$count = $this->get($this->key);
|
||||
if ($count >= $this->count) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除该ip记录错误次数
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:55
|
||||
*/
|
||||
public function relieve()
|
||||
{
|
||||
$this->delete($this->key);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
105
app/common/cache/UserTokenCache.php
vendored
Normal file
105
app/common/cache/UserTokenCache.php
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserSession;
|
||||
|
||||
class UserTokenCache extends BaseCache
|
||||
{
|
||||
|
||||
private $prefix = 'token_user_';
|
||||
|
||||
|
||||
/**
|
||||
* @notes 通过token获取缓存用户信息
|
||||
* @param $token
|
||||
* @return array|false|mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/9/16 10:11
|
||||
*/
|
||||
public function getUserInfo($token)
|
||||
{
|
||||
//直接从缓存获取
|
||||
$userInfo = $this->get($this->prefix . $token);
|
||||
if ($userInfo) {
|
||||
return $userInfo;
|
||||
}
|
||||
|
||||
//从数据获取信息被设置缓存(可能后台清除缓存)
|
||||
$userInfo = $this->setUserInfo($token);
|
||||
if ($userInfo) {
|
||||
return $userInfo;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 通过有效token设置用户信息缓存
|
||||
* @param $token
|
||||
* @return array|false|mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/9/16 10:11
|
||||
*/
|
||||
public function setUserInfo($token)
|
||||
{
|
||||
$userSession = UserSession::where([['token', '=', $token], ['expire_time', '>', time()]])->find();
|
||||
if (empty($userSession)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$user = User::where('id', '=', $userSession->user_id)
|
||||
->find();
|
||||
|
||||
$userInfo = [
|
||||
'user_id' => $user->id,
|
||||
'nickname' => $user->nickname,
|
||||
'token' => $token,
|
||||
'sn' => $user->sn,
|
||||
'mobile' => $user->mobile,
|
||||
'avatar' => $user->avatar,
|
||||
'terminal' => $userSession->terminal,
|
||||
'expire_time' => $userSession->expire_time,
|
||||
];
|
||||
|
||||
$ttl = new \DateTime(Date('Y-m-d H:i:s', $userSession->expire_time));
|
||||
$this->set($this->prefix . $token, $userInfo, $ttl);
|
||||
return $this->getUserInfo($token);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除缓存
|
||||
* @param $token
|
||||
* @return bool
|
||||
* @author 段誉
|
||||
* @date 2022/9/16 10:13
|
||||
*/
|
||||
public function deleteUserInfo($token)
|
||||
{
|
||||
return $this->delete($this->prefix . $token);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user