This commit is contained in:
net909 2024-05-24 15:11:28 +08:00
parent 5cd6b108f0
commit 8e4fd32f8c
2 changed files with 3 additions and 1 deletions

View File

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

View File

@ -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');