mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-07-07 01:52:48 +08:00
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:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user