mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-07-01 18:12:49 +08:00
feat(post): 新增手机图片排版与AI智能排版功能
- 新增手机图片排版功能,支持小红书/抖音尺寸输出 - 新增AI智能排版顾问,支持内容分析与优化推荐 - 新增AI供应商管理,支持多渠道配置与同步 - 新增文章输出管理页面,支持图片预览与批量下载 - 新增字体文件与排版样式配置
This commit is contained in:
62
app/model/PostOutput.php
Normal file
62
app/model/PostOutput.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use app\common\model\Base;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class PostOutput extends Base
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $defaultSoftDelete = 0;
|
||||
|
||||
protected $name = 'post_output';
|
||||
|
||||
protected $json = ['config'];
|
||||
|
||||
public const STATUS_PROCESSING = 0;
|
||||
public const STATUS_COMPLETED = 1;
|
||||
public const STATUS_FAILED = 2;
|
||||
|
||||
public static $statusList = [
|
||||
0 => '生成中',
|
||||
1 => '已完成',
|
||||
2 => '失败',
|
||||
];
|
||||
|
||||
public static $autoClearCache = [];
|
||||
|
||||
public function post()
|
||||
{
|
||||
return $this->belongsTo(Post::class, 'post_id');
|
||||
}
|
||||
|
||||
public function files()
|
||||
{
|
||||
return $this->hasMany(PostOutputFile::class, 'output_id');
|
||||
}
|
||||
|
||||
public function getStatusTextAttr()
|
||||
{
|
||||
return self::$statusList[$this->getData('status')] ?? '未知';
|
||||
}
|
||||
|
||||
public function getOutputTypeTextAttr()
|
||||
{
|
||||
$types = config('output_type');
|
||||
$type = $this->getData('output_type');
|
||||
|
||||
return $types[$type]['name'] ?? $type;
|
||||
}
|
||||
|
||||
public static function getByPostAndType(int $postId, string $type)
|
||||
{
|
||||
return static::where('post_id', $postId)
|
||||
->where('output_type', $type)
|
||||
->order('id', 'desc')
|
||||
->select();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user