修复syskey为空错误

This commit is contained in:
net909
2026-07-28 21:33:16 +08:00
parent 8ef3e2e802
commit f34a28ecbd
3 changed files with 10 additions and 2 deletions
+8
View File
@@ -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);