...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
namespace app\web\controller;
|
|
|
|
|
|
|
|
|
use think\Cache;
|
|
|
use think\Db;
|
|
|
use think\Request;
|
|
|
|
...
|
...
|
@@ -46,8 +47,10 @@ class Index extends Controller |
|
|
return json_encode($data);
|
|
|
}else{
|
|
|
//Cookie::set('name',$name);
|
|
|
session('name', $list['username']);
|
|
|
// session('name', $list['username']);
|
|
|
// session('id', $list['id']);
|
|
|
Cache::set('name',$list['username'],3600);
|
|
|
Cache::set('id',$list['id'],3600);
|
|
|
$data=[
|
|
|
'data'=>$list['username'],
|
|
|
'code'=>200,
|
...
|
...
|
@@ -69,7 +72,8 @@ class Index extends Controller |
|
|
public function index()
|
|
|
{
|
|
|
//$user=Cookie::get('name');
|
|
|
$user = Session::get('name');
|
|
|
//$user = Session::get('name');
|
|
|
$user=Cache::get('name');
|
|
|
if(!$user){
|
|
|
//重定向到指定的URL地址
|
|
|
$this->error('您未进行登录', 'web/index/login'); exit;
|
...
|
...
|
@@ -82,7 +86,8 @@ class Index extends Controller |
|
|
public function loginout()
|
|
|
{
|
|
|
//Cookie::delete('name');
|
|
|
Session::clear();
|
|
|
//Session::clear();
|
|
|
Cache::clear();
|
|
|
$this->view->engine->layout(false);
|
|
|
return $this->fetch('login');
|
|
|
}
|
...
|
...
|
|