diff --git a/app/controller/Article.php b/app/controller/Article.php index 7233238..642d285 100755 --- a/app/controller/Article.php +++ b/app/controller/Article.php @@ -187,4 +187,29 @@ class Article extends Base return $this->json(0, 'ok', $items); } + + //获取活动列表 + public function getActivity() + { + $categoryId = input('category_id/d', 0); + $page = input('page/d', 1); + $size = input('size/d', 10); + + if ($categoryId <= 0) { + return $this->json(1, '参数错误'); + } + $category = Category::getById($categoryId); + if (empty($category)) { + return $this->json(2, '栏目不存在'); + } + + $items = MArticle::findListByWhere(["category_id" => $categoryId, 'is_prev' => 0], $page, $size); + + foreach ($items as $item) { + $item['uri'] = archiveGetUri($item); + $item['src'] = $this->isMobile ? $item['src_mobile'] : $item['src']; + } + + return $this->json(0, 'ok', $items); + } } \ No newline at end of file diff --git a/view/page/activity.html b/view/page/activity.html index fb2ea7f..a65d315 100755 --- a/view/page/activity.html +++ b/view/page/activity.html @@ -20,11 +20,8 @@ $previewList = Article::getList(Category::CATEGORY_BRAND_ACTIVITY, 10, null, ['i
{$blocks['brand_activity']['value']}
{$blocks['brand_activity']['title']} - {foreach $items as $k => $item} - {if $k%4==0} -