From d35febf9f6fefedc4e3dd214d7083f57e0f88ce0 Mon Sep 17 00:00:00 2001 From: augushong Date: Sat, 18 Apr 2020 21:46:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=96=87=E7=AB=A0=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/model/Post.php | 10 ++++++++++ view/admin/post/index.html | 2 ++ 2 files changed, 12 insertions(+) diff --git a/app/model/Post.php b/app/model/Post.php index 055b276..c3b8752 100644 --- a/app/model/Post.php +++ b/app/model/Post.php @@ -14,6 +14,11 @@ class Post extends Model { // + public static $stausNameList = [ + 0=>'不发布', + 1=>'发布' + ]; + use SoftDelete; protected $defaultSoftDelete = 0; @@ -28,6 +33,11 @@ class Post extends Model return $this->hasMany(PostTag::class,'post_id'); } + public function getStatusNameAttr() + { + return self::$stausNameList[$this->getData('status')]; + } + public function setPubishTimeAttr($value) { return strtotime($value); diff --git a/view/admin/post/index.html b/view/admin/post/index.html index a182d3d..7c4bdd8 100644 --- a/view/admin/post/index.html +++ b/view/admin/post/index.html @@ -44,6 +44,7 @@ 封面 简介 排序 + 状态 操作 @@ -57,6 +58,7 @@ {$vo.desc} {$vo.sort} + {$vo.status_name}
编辑