|
|
@@ -2,6 +2,8 @@
|
|
|
namespace app\api\controller\publics;
|
|
|
|
|
|
use app\models\article\ArticleCategory;
|
|
|
+use app\Request;
|
|
|
+use crmeb\services\UtilService;
|
|
|
|
|
|
/**
|
|
|
* 文章分类类
|
|
|
@@ -17,9 +19,17 @@ class ArticleCategoryController
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
* @throws \think\exception\DbException
|
|
|
*/
|
|
|
- public function lst()
|
|
|
+ public function lst(Request $request)
|
|
|
{
|
|
|
- $cateInfo = ArticleCategory::getArticleCategory();
|
|
|
+ list($id) = UtilService::postMore([
|
|
|
+ ['id',0],//分类父id编号
|
|
|
+ ], $request, true);
|
|
|
+ if ($id>0){
|
|
|
+ $cateInfo = ArticleCategory::getIdArticleCategoryWithChildren($id);
|
|
|
+ }else{
|
|
|
+ $cateInfo = ArticleCategory::getArticleCategory();
|
|
|
+ }
|
|
|
+
|
|
|
if($cateInfo) $cateInfo = $cateInfo->toArray();
|
|
|
else $cateInfo = [];
|
|
|
array_unshift($cateInfo,['id'=>0,'title'=>'热门']);
|