From 21bcbf25639063fbfaef71d86422b2a660cb4c99 Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Sat, 20 Nov 2021 23:52:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E7=AB=A0=E7=AE=A1=E7=90=86=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/ArticleService.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/app/service/ArticleService.php b/app/service/ArticleService.php index b647c6df7..8ad1b126b 100755 --- a/app/service/ArticleService.php +++ b/app/service/ArticleService.php @@ -610,5 +610,36 @@ class ArticleService 'next' => empty($next) ? null : $next[0], ]; } + + /** + * 获取分类和所有文章 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-10-19 + * @desc description + * @param [array] $params [输入参数] + */ + public static function ArticleCategoryListContent($params = []) + { + $data = Db::name('ArticleCategory')->field('id,name')->where(['is_enable'=>1])->order('id asc, sort asc')->select()->toArray(); + if(!empty($data)) + { + foreach($data as &$v) + { + $items = Db::name('Article')->field('id,title,title_color')->where(['article_category_id'=>$v['id'], 'is_enable'=>1])->select()->toArray(); + if(!empty($items)) + { + foreach($items as &$vs) + { + // url + $vs['url'] = (APPLICATION == 'web') ? MyUrl('index/article/index', ['id'=>$vs['id']]) : '/pages/article-detail/article-detail?id='.$vs['id']; + } + } + $v['items'] = $items; + } + } + return DataReturn('处理成功', 0, $data); + } } ?> \ No newline at end of file