diff --git a/plugins/addon/theme_configurator/model/ThemeConfigModel.php b/plugins/addon/theme_configurator/model/ThemeConfigModel.php index 883aeb2..6303e4a 100644 --- a/plugins/addon/theme_configurator/model/ThemeConfigModel.php +++ b/plugins/addon/theme_configurator/model/ThemeConfigModel.php @@ -87,8 +87,13 @@ class ThemeConfigModel 'update_time' => time(), ]; - // 删除所有旧记录,确保只有一条最新记录 - $this->query()->delete(); + // 查询是否有旧记录 + $exists = $this->query()->find(); + + if ($exists) { + // 有旧记录:删除所有旧记录,确保只有一条最新记录 + $this->query()->delete(); + } // 插入新记录 $this->query()->insert($payload);