From ca7678cea6bfec977b470819fe32245412083587 Mon Sep 17 00:00:00 2001 From: wanghousheng Date: Sun, 4 Feb 2024 17:25:06 +0800 Subject: [PATCH] 1 --- app/api/model/Article.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/api/model/Article.php b/app/api/model/Article.php index 5f14362f..52b89fab 100644 --- a/app/api/model/Article.php +++ b/app/api/model/Article.php @@ -141,4 +141,14 @@ class Article extends ArticleModel return $this->save(['is_delete' => 1]); } + /** + * 获取文章总数量 + * @param array $where + * @return int + */ + public static function getArticleTotal(array $where = []): int + { + return (new static)->where($where)->where('is_delete', '=', 0)->count(); + } + } \ No newline at end of file