修复syskey为空错误
This commit is contained in:
@@ -5,6 +5,8 @@ namespace app\middleware;
|
||||
|
||||
use think\facade\Db;
|
||||
use think\facade\Config;
|
||||
use think\facade\Cache;
|
||||
use think\helper\Str;
|
||||
|
||||
class LoadConfig
|
||||
{
|
||||
@@ -22,6 +24,12 @@ class LoadConfig
|
||||
}
|
||||
|
||||
$res = Db::name('config')->cache('configs',0)->column('value','key');
|
||||
if (empty($res['syskey'])) {
|
||||
$syskey = Str::random(16);
|
||||
config_set('syskey', $syskey);
|
||||
Cache::delete('configs');
|
||||
$res['syskey'] = $syskey;
|
||||
}
|
||||
Config::set($res, 'sys');
|
||||
|
||||
return $next($request);
|
||||
|
||||
Reference in New Issue
Block a user