This commit is contained in:
@@ -51,7 +51,7 @@ class ThemeConfigModel
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// 缓存未命中,从数据库读取
|
// 缓存未命中,从数据库读取
|
||||||
$row = $this->query()->order('id', 'asc')->find();
|
$row = $this->query()->order('id', 'desc')->find();
|
||||||
error_log('ThemeConfigModel::getConfig() - 查询结果: ' . ($row ? 'found' : 'not found'));
|
error_log('ThemeConfigModel::getConfig() - 查询结果: ' . ($row ? 'found' : 'not found'));
|
||||||
if ($row) {
|
if ($row) {
|
||||||
error_log('config字段长度: ' . strlen($row['config']));
|
error_log('config字段长度: ' . strlen($row['config']));
|
||||||
@@ -87,12 +87,11 @@ class ThemeConfigModel
|
|||||||
'update_time' => time(),
|
'update_time' => time(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$exists = $this->query()->find();
|
// 删除所有旧记录,确保只有一条最新记录
|
||||||
if ($exists) {
|
$this->query()->delete();
|
||||||
$this->query()->where('id', $exists['id'])->update($payload);
|
|
||||||
} else {
|
// 插入新记录
|
||||||
$this->query()->insert($payload);
|
$this->query()->insert($payload);
|
||||||
}
|
|
||||||
|
|
||||||
// 清除缓存,确保下次读取最新数据
|
// 清除缓存,确保下次读取最新数据
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user