fix(Post): 修复排版内容副本读取时配置字段类型转换问题

确保从 postOutput 配置中读取 content_html 时,配置字段已转换为数组,避免因对象类型导致的错误。
This commit is contained in:
augushong
2026-05-03 19:49:38 +08:00
parent 2ba48fd58d
commit 2bbde158b9
5 changed files with 6 additions and 3 deletions

View File

@@ -368,9 +368,12 @@ class Post extends Common
// 排版内容副本:优先使用已保存的副本,否则使用原文
$layoutContentHtml = $model_post->content_html;
$layoutConfig = [];
if ($postOutput && !empty($postOutput->config['content_html'])) {
$layoutContentHtml = $postOutput->config['content_html'];
$layoutConfig = $postOutput->config;
if ($postOutput && !empty($postOutput->config)) {
$config = (array) $postOutput->config;
if (!empty($config['content_html'])) {
$layoutContentHtml = $config['content_html'];
$layoutConfig = $config;
}
}
View::assign('post', $model_post);