修复插件
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
yiqiu
2025-12-28 16:12:16 +08:00
parent 6c960f8175
commit 58780d959b
2 changed files with 9 additions and 0 deletions

View File

@@ -17,8 +17,11 @@ class ThemeController extends PluginAdminBaseController
*/ */
public function config(): Response public function config(): Response
{ {
// 调试日志
error_log('ThemeController::config() 被调用');
$model = new ThemeConfigModel(); $model = new ThemeConfigModel();
$config = $model->getConfig(); $config = $model->getConfig();
error_log('读取到的配置: ' . json_encode($config));
return json([ return json([
'status' => 200, 'status' => 200,

View File

@@ -34,6 +34,8 @@ class ThemeConfigModel
*/ */
public function getConfig(): array public function getConfig(): array
{ {
// 临时禁用缓存读取用于调试
/*
// 尝试从缓存获取 // 尝试从缓存获取
try { try {
$config = Cache::get(self::CACHE_KEY); $config = Cache::get(self::CACHE_KEY);
@@ -45,6 +47,7 @@ class ThemeConfigModel
} catch (\Throwable $e) { } catch (\Throwable $e) {
// 缓存系统异常,继续从数据库读取 // 缓存系统异常,继续从数据库读取
} }
*/
// 缓存未命中,从数据库读取 // 缓存未命中,从数据库读取
$row = $this->query()->order('id', 'asc')->find(); $row = $this->query()->order('id', 'asc')->find();
@@ -55,12 +58,15 @@ class ThemeConfigModel
$config = is_array($config) ? $config : $this->defaultConfig(); $config = is_array($config) ? $config : $this->defaultConfig();
} }
// 临时禁用缓存写入用于调试
/*
// 写入缓存 (忽略缓存写入失败) // 写入缓存 (忽略缓存写入失败)
try { try {
Cache::set(self::CACHE_KEY, $config, self::CACHE_TTL); Cache::set(self::CACHE_KEY, $config, self::CACHE_TTL);
} catch (\Throwable $e) { } catch (\Throwable $e) {
// 忽略缓存写入失败 // 忽略缓存写入失败
} }
*/
return $config; return $config;
} }