mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
新增面板新增markdown导出
This commit is contained in:
@@ -5,7 +5,9 @@ declare(strict_types=1);
|
||||
namespace app\model;
|
||||
|
||||
use app\common\model\Base;
|
||||
use app\common\tools\PostBlock;
|
||||
use app\common\tools\PostShow;
|
||||
use League\HTMLToMarkdown\HtmlConverter;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Request;
|
||||
use think\Model;
|
||||
@@ -56,9 +58,6 @@ class Post extends Base
|
||||
|
||||
public function getCommentCountAttr()
|
||||
{
|
||||
|
||||
|
||||
|
||||
return PostComment::getPostCommentsCount($this->getData('id'));
|
||||
}
|
||||
|
||||
@@ -143,15 +142,26 @@ class Post extends Base
|
||||
return strtotime($value);
|
||||
}
|
||||
|
||||
public function setContentAttr($value)
|
||||
{
|
||||
return json_encode($value);
|
||||
}
|
||||
public function setContentHtmlAttr($value)
|
||||
{
|
||||
return trim($value);
|
||||
}
|
||||
|
||||
public function getContentMarkdownAttr()
|
||||
{
|
||||
$content_html = $this->getAttr('content_html');
|
||||
|
||||
|
||||
$content_html .= PostBlock::copyright($this);
|
||||
|
||||
|
||||
$converter = new HtmlConverter(array('strip_tags' => true));
|
||||
|
||||
$markdown = $converter->convert($content_html);
|
||||
|
||||
return $markdown;
|
||||
}
|
||||
|
||||
public function getContentHtmlShowAttr()
|
||||
{
|
||||
|
||||
@@ -160,11 +170,6 @@ class Post extends Base
|
||||
return PostShow::handleCopyright($content);
|
||||
}
|
||||
|
||||
public function getContentAttr($value)
|
||||
{
|
||||
return json_decode($value, true);
|
||||
}
|
||||
|
||||
public function getPosterAttr($value)
|
||||
{
|
||||
if (empty($value)) {
|
||||
|
||||
Reference in New Issue
Block a user