作者 王晓刚
1 个管道 的构建 通过 耗费 1 秒

修改问题文档

@@ -4,6 +4,7 @@ namespace app\admin\controller; @@ -4,6 +4,7 @@ namespace app\admin\controller;
4 4
5 use app\admin\model\AdminLog; 5 use app\admin\model\AdminLog;
6 use app\common\controller\Backend; 6 use app\common\controller\Backend;
  7 +use app\common\library\Token;
7 use think\Config; 8 use think\Config;
8 use think\Db; 9 use think\Db;
9 use think\Hook; 10 use think\Hook;
@@ -108,8 +109,8 @@ class Index extends Backend @@ -108,8 +109,8 @@ class Index extends Backend
108 $this->view->assign('title', __('Login')); 109 $this->view->assign('title', __('Login'));
109 Hook::listen("admin_login_init", $this->request); 110 Hook::listen("admin_login_init", $this->request);
110 111
111 - $token = cookie('token');  
112 - dump($token); 112 + $user = cookie('user');
  113 + dump($user);
113 if(!empty($token)){ 114 if(!empty($token)){
114 $user_id = Db::name('user_token')->where(['token'=>$token])->value('user_id'); 115 $user_id = Db::name('user_token')->where(['token'=>$token])->value('user_id');
115 dump($user_id); 116 dump($user_id);
@@ -141,6 +141,7 @@ class User extends Frontend @@ -141,6 +141,7 @@ class User extends Frontend
141 $token = $this->auth->getToken(); 141 $token = $this->auth->getToken();
142 session('token',$token); 142 session('token',$token);
143 Cookie::set('token',$token); 143 Cookie::set('token',$token);
  144 + session('user',$result);
144 $this->success('SUCCESS','',['target_url'=>rawurldecode($target_url)]); 145 $this->success('SUCCESS','',['target_url'=>rawurldecode($target_url)]);
145 } 146 }
146 147
@@ -193,6 +194,7 @@ class User extends Frontend @@ -193,6 +194,7 @@ class User extends Frontend
193 $token = $this->auth->getToken(); 194 $token = $this->auth->getToken();
194 session('token',$token); 195 session('token',$token);
195 Cookie::set('token',$token); 196 Cookie::set('token',$token);
  197 + session('user',$result1);
196 $this->success('SUCCESS'); 198 $this->success('SUCCESS');
197 } 199 }
198 200