'生成中', 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(); } }