ArticleCategoryController.php 758 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace app\api\controller\publics;
  3. use app\models\article\ArticleCategory;
  4. /**
  5. * 文章分类类
  6. * Class ArticleCategoryController
  7. * @package app\api\controller\publics
  8. */
  9. class ArticleCategoryController
  10. {
  11. /**
  12. * 文章分类列表
  13. * @return mixed
  14. * @throws \think\db\exception\DataNotFoundException
  15. * @throws \think\db\exception\ModelNotFoundException
  16. * @throws \think\exception\DbException
  17. */
  18. public function lst()
  19. {
  20. $cateInfo = ArticleCategory::getArticleCategory();
  21. if($cateInfo) $cateInfo = $cateInfo->toArray();
  22. else $cateInfo = [];
  23. array_unshift($cateInfo,['id'=>0,'title'=>'热门']);
  24. return app('json')->successful($cateInfo);
  25. }
  26. }