refactor(phone-image): Wave 2 - form, controller, JS engine, API updates

T3: Add cover_text textarea to post edit form

T4: Update Post controller - content copy + cover_text passing

T5: Refactor JS engine - remove old APIs, add forced breaks, page numbers, per-page alignment

T8: Add cover_text to API default_fields, apidoc (4 places), AGENTS.md
This commit is contained in:
augushong
2026-05-02 09:16:05 +08:00
parent 2aa60f87ed
commit bcd00e32ea
6 changed files with 109 additions and 186 deletions

View File

@@ -358,7 +358,24 @@ class Post extends Common
if (empty($model_post)) {
$this->error('文章不存在');
}
// 查询已有的排版输出,获取排版内容副本
$postOutput = \app\model\PostOutput::where('post_id', $id)
->where('output_type', 'phone_image')
->order('id', 'desc')
->find();
// 排版内容副本:优先使用已保存的副本,否则使用原文
$layoutContentHtml = $model_post->content_html;
$layoutConfig = [];
if ($postOutput && !empty($postOutput->config['content_html'])) {
$layoutContentHtml = $postOutput->config['content_html'];
$layoutConfig = $postOutput->config;
}
View::assign('post', $model_post);
View::assign('layoutContentHtml', $layoutContentHtml);
View::assign('layoutConfig', $layoutConfig);
return View::fetch();
}
@@ -395,6 +412,10 @@ class Post extends Common
}
$config = $data['config'] ?? [];
// 确保排版内容副本被保存到 config
if (isset($data['content_html']) && !isset($config['content_html'])) {
$config['content_html'] = $data['content_html'];
}
$pages = $data['pages'] ?? [];
$admin_id = session('admin_id') ?? 0;

View File

@@ -154,6 +154,7 @@ class Articles extends BaseController
'jump_to_url_status' => 0,
'poster' => '',
'desc' => '',
'cover_text' => '',
'author_name' => '',
'hits' => 0,
'is_top' => 0,