wugg 9 months ago
parent
commit
48f4d794ef
2 changed files with 4 additions and 5 deletions
  1. 3 4
      app/common/User.php
  2. 1 1
      app/user/controller/Login.php

+ 3 - 4
app/common/User.php

@@ -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;
     }

+ 1 - 1
app/user/controller/Login.php

@@ -20,7 +20,7 @@ class Login extends Base{
 			"captcha|验证码"=>"array"
 			]);
 		if($valid->check($param)==false)return error($valid->getError());
-		$info = $this->model->with(['accountItem'=>['itemName'],'userInfo'])->where
+		$info = $this->model->with(['accountItem'=>['itemName'],"company_relaton",'userInfo'])->where
 		(["username"=>$param['username'],"is_del"=>0])->findOrEmpty();
 		  $info->hidden(['userInfo','password','salt','accountItem','openId']);
 		if($info->isEmpty()) return error("账户不存在");