refactor(typesetting): Wave1 - UPSERT改造 + 移除历史记录后端接口

- PhoneImage.php: saveConfigOnly/createOutput改为find-then-update-or-create
- Post.php: 移除6个历史记录方法(postOutputList/getOutputListJson等)
- 删除post_output/index.html模板
This commit is contained in:
augushong
2026-05-17 00:22:04 +08:00
parent e3a4cd000c
commit aa067ad202
3 changed files with 30 additions and 316 deletions

View File

@@ -250,6 +250,22 @@ class PhoneImage implements PostOutputManagerInterface
*/
public function createOutput(int $postId, array $config, int $adminId): PostOutput
{
$existing = PostOutput::where('post_id', $postId)
->where('output_type', 'phone_image')
->where('delete_time', 0)
->find();
if ($existing) {
PostOutputFile::where('output_id', $existing->id)->delete();
$existing->config = $config;
$existing->status = PostOutput::STATUS_PROCESSING;
$existing->page_count = 0;
$existing->admin_id = $adminId;
$existing->save();
return $existing;
}
return PostOutput::create([
'post_id' => $postId,
'output_type' => 'phone_image',
@@ -280,6 +296,20 @@ class PhoneImage implements PostOutputManagerInterface
*/
public static function saveConfigOnly(int $postId, array $config, int $adminId): PostOutput
{
$existing = PostOutput::where('post_id', $postId)
->where('output_type', 'phone_image')
->where('delete_time', 0)
->find();
if ($existing) {
$existing->config = $config;
$existing->content_html = $config['content_html'] ?? $existing->content_html;
$existing->admin_id = $adminId;
$existing->save();
return $existing;
}
return PostOutput::create([
'post_id' => $postId,
'output_type' => 'phone_image',