feat: 增加markdown下载

This commit is contained in:
augushong
2025-06-23 12:23:15 +08:00
parent 1706941705
commit 3220b1a340
2 changed files with 15 additions and 2 deletions

View File

@@ -53,9 +53,9 @@ class Post extends Common
->where('type', $this->request->param('type', 1))
->order('id desc');
if($platform_status == 1){
if ($platform_status == 1) {
$model_list = $model_list->where('post_platform_status', 'like', "%,{$platform_type},%");
}else if ($platform_status === '0'){
} elseif ($platform_status === '0') {
$model_list = $model_list->where('post_platform_status', 'not like', "%,{$platform_type},%");
}
@@ -314,4 +314,12 @@ class Post extends Common
return json_message();
}
public function downloadMarkdown($id)
{
$model_post = ModelPost::find($id);
$mardkown = $model_post->content_markdown;
return download($mardkown, $model_post->title . '.md', true);
}
}

View File

@@ -151,6 +151,11 @@
class=" select-markdown"
href="#post-markdown"
>选中markdown</a>
<a
class=""
href="{:url('post/downloadMarkdown',['id'=>$post.id])}"
target="_blank"
>下载markdown</a>
<hr>
<div class="post-platform-list">