diff --git a/app/api/controller/Article.php b/app/api/controller/Article.php index 44a31d79..cf511d93 100644 --- a/app/api/controller/Article.php +++ b/app/api/controller/Article.php @@ -46,4 +46,11 @@ class Article extends Controller $detail = ArticleModel::getDetail($articleId); return $this->renderSuccess(compact('detail')); } + + public function helpCenter(): Json + { + $model = new ArticleModel; + $list = $model->helpCenter(); + return $this->renderSuccess(compact('list')); + } } diff --git a/app/api/model/Article.php b/app/api/model/Article.php index c6d2d9e7..447bdbe8 100644 --- a/app/api/model/Article.php +++ b/app/api/model/Article.php @@ -94,4 +94,15 @@ class Article extends ArticleModel ->paginate($limit); return static::preload($list, ['image', 'category']); } + + public function helpCenter() + { + $list = $this->withoutField(['content']) + ->where('status', '=', 1) + ->where('is_delete', '=', 0) + ->order(['sort' => 'asc', 'create_time' => 'desc']) + ->select()->toArray(); + $data = static::preload($list, ['image', 'category']); + return $data; + } } \ No newline at end of file