Commit 9685f642 by zhufx

用户实体setToken增加从redis获取用户信息

parent 615c5175
......@@ -15,6 +15,7 @@ use Hdll\Services\Auth\Exception\AuthException;
use Swoft\App;
use Swoft\Bean\Annotation\Bean;
use Swoft\Cache\Cache;
use Swoft\Redis\Redis;
/**
* 用户实体
......@@ -133,10 +134,10 @@ class User
}
/**
* @var Cache $cache
* @var Redis $redis
*/
$cache = App::getBean("cache");
$info = $cache->get('AUTH:'.$value);
$redis = App::getBean(Redis::class);
$info = $redis->get('AUTH:'.$value);
if ( empty($info) ) {
return [false,AuthError::NOT_FOUND_USER];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment