diff --git a/app/middleware/AuthUser.php b/app/middleware/AuthUser.php index 07b78b2..833de49 100644 --- a/app/middleware/AuthUser.php +++ b/app/middleware/AuthUser.php @@ -12,7 +12,7 @@ class AuthUser $islogin = false; $cookie = cookie('user_token'); $user = null; - if($cookie){ + if($cookie && config_get('sys_key')){ $token=authcode($cookie, 'DECODE', config_get('sys_key')); if($token){ list($type, $uid, $sid, $expiretime) = explode("\t", $token); diff --git a/app/middleware/LoadConfig.php b/app/middleware/LoadConfig.php index f9c0ff8..198c39a 100644 --- a/app/middleware/LoadConfig.php +++ b/app/middleware/LoadConfig.php @@ -6,6 +6,7 @@ namespace app\middleware; use Exception; use think\facade\Db; use think\facade\Config; +use think\facade\Cache; class LoadConfig { @@ -33,6 +34,7 @@ class LoadConfig $res = Db::name('config')->cache('configs',0)->column('value','key'); if(empty($res['sys_key']) && !empty(env('app.sys_key'))){ config_set('sys_key', env('app.sys_key')); + Cache::delete('configs'); $res['sys_key'] = env('app.sys_key'); } Config::set($res, 'sys');