From bf2af3a4b7e159284c22f14d3bf771aa222ca7c2 Mon Sep 17 00:00:00 2001 From: augushong Date: Mon, 5 May 2025 10:59:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BC=80=E5=A7=8B=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Post.php | 18 ++++- app/common.php | 6 ++ view/admin/common/left_post.html | 35 +++------ view/admin/post/index_output.html | 125 ++++++++++++++++++++++++++++++ view/admin/post/output.html | 2 +- 5 files changed, 159 insertions(+), 27 deletions(-) create mode 100644 view/admin/post/index_output.html diff --git a/app/admin/controller/Post.php b/app/admin/controller/Post.php index 9118593..2a3576c 100644 --- a/app/admin/controller/Post.php +++ b/app/admin/controller/Post.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace app\admin\controller; -use app\model\Nav; use app\model\Post as ModelPost; use app\model\PostCategory; use app\model\PostTag; @@ -43,6 +42,21 @@ class Post extends Common return View::fetch(); } + public function indexOutput() + { + $model_list = ModelPost::with(['categorys.category', 'tags.tag']) + ->where('type', $this->request->param('type', 1)) + ->order('id desc'); + + $list = $model_list->paginate([ + 'query' => $this->request->get(), + ]); + + View::assign('list', $list); + + return View::fetch(); + } + /** * 显示创建资源表单页. * @@ -151,7 +165,7 @@ class Post extends Common public function output($id) { $model_post = ModelPost::find($id); - $list_post_platform = Nav::where('type', 12)->order('sort asc')->select(); + $list_post_platform = list_post_platform(); foreach ($list_post_platform as $model_platform) { $platform_info = explode("\n", $model_platform->desc); diff --git a/app/common.php b/app/common.php index 7278c69..fd9820a 100644 --- a/app/common.php +++ b/app/common.php @@ -14,6 +14,7 @@ use app\model\Admin; use app\model\AdminPermission; +use app\model\Nav; use app\model\SystemConfig; use app\model\UploadFiles; use League\Flysystem\Util\MimeType; @@ -317,3 +318,8 @@ function show_time_ago($timestamp) return $result; } + +function list_post_platform() +{ + return Nav::where('type', 12)->order('sort asc')->cache(30)->select(); +} diff --git a/view/admin/common/left_post.html b/view/admin/common/left_post.html index 41ec6fa..513578e 100644 --- a/view/admin/common/left_post.html +++ b/view/admin/common/left_post.html @@ -3,10 +3,7 @@
-
    +
    • 评论管理
    -
      + @@ -79,10 +69,7 @@
      -
        +
        • + + + + + + + 内容管理 + {include file="common/_require"} + + + + + + +
          + {include file="common/_header"} + {include file="common/left_post"} + +
          + +
          +
          + + 首页 + 系统信息 + +
          +
          +
          + 添加 +
          +
          +
          + + + + + + + + + + + + + + + {volist name='list' id='vo'} + + + + + + + + + + + + + {/volist} + {if condition="count($list) == 0" } + + + + {/if} + +
          ID名称封面简介排序状态操作
          {$vo.id}{$vo.title}{$vo.desc_short}{$vo.sort}{$vo.status_name} +
          + + 导出 +
          +
          暂无数据
          +
          + {$list|raw} +
          +
          +
          +
          + {include file="common/_footer"} +
          + + + + + \ No newline at end of file diff --git a/view/admin/post/output.html b/view/admin/post/output.html index 08f5954..7a1921c 100644 --- a/view/admin/post/output.html +++ b/view/admin/post/output.html @@ -154,7 +154,7 @@
          - {volist name='list_post_platform' id='vo'} + {volist name=':list_post_platform()' id='vo'}