|
@@ -1,7 +1,7 @@
|
|
|
<?php
|
|
|
namespace app\common;
|
|
|
|
|
|
-use app\common\facade\Token;
|
|
|
+use think\facade\Cache;
|
|
|
class User {
|
|
|
protected static $instance;
|
|
|
protected $logined = false;
|
|
@@ -47,7 +47,7 @@ class User {
|
|
|
|
|
|
public function init($token): bool
|
|
|
{
|
|
|
- $tokenData = Token::get('user:info:'.$token);
|
|
|
+ $tokenData = Cache::get('user:info:'.$token);
|
|
|
if (!$tokenData) {
|
|
|
$this->token= $token;
|
|
|
$this->setError('用户信息已失效');
|
|
@@ -116,9 +116,8 @@ class User {
|
|
|
return false;
|
|
|
}
|
|
|
$this->logined = true;
|
|
|
-
|
|
|
if ($this->token!='') {
|
|
|
- Token::set($this->token, 'user',$this->userinfo,$this->keeptime);
|
|
|
+ Cache::set("user:info:{$this->token}",$this->userinfo,$this->keeptime);
|
|
|
}
|
|
|
return true;
|
|
|
}
|