From 90b5d5b70032e2e3a8df3459f09313dba74fd80c Mon Sep 17 00:00:00 2001 From: yin5th <541304803@qq.com> Date: Tue, 11 Oct 2022 13:58:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=93=81=E7=89=8C=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Article.php | 24 +++++++ app/model/Article.php | 2 +- app/model/Category.php | 2 + view/manager/article/add.html | 12 ++++ view/manager/article/edit.html | 11 ++++ view/manager/content/article.html | 7 ++ view/page/activity.html | 103 ++++++++++++++++++++++++++++++ 7 files changed, 160 insertions(+), 1 deletion(-) create mode 100755 view/page/activity.html diff --git a/app/controller/Article.php b/app/controller/Article.php index 9f1b025..7c9a380 100755 --- a/app/controller/Article.php +++ b/app/controller/Article.php @@ -158,5 +158,29 @@ class Article extends Base return $this->json(0, 'ok', $items); } + //文章列表接口,获取栏目下文章列表 + public function getList() + { + $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], $page, $size); + + foreach ($items as $item) { + $item['uri'] = archiveGetUri($item); + $item['create_date_d'] = date('d', $item['create_time']); + $item['create_date_y_m'] = date('Y-m', $item['create_time']); + } + + return $this->json(0, 'ok', $items); + } } \ No newline at end of file diff --git a/app/model/Article.php b/app/model/Article.php index 94063b5..2f57b27 100755 --- a/app/model/Article.php +++ b/app/model/Article.php @@ -192,7 +192,7 @@ class Article extends Base if (is_array($param) && count($param) > 0) { $pageParam['param'] = $param; foreach ($param as $vo) { - if (in_array($vo, ['top', 'hot', 'recommend'], true)) { + if (in_array($vo, ['top', 'hot', 'recommend', 'is_prev'], true)) { $whereMap[] = ["{$vo}", '=', 1]; } } diff --git a/app/model/Category.php b/app/model/Category.php index 5804d84..fff3459 100755 --- a/app/model/Category.php +++ b/app/model/Category.php @@ -20,6 +20,8 @@ class Category extends Base public const CATEGORY_COMPANY_EVENT = 37; // 企业荣誉 public const CATEGORY_COMPANY_HONOR = 38; + // 品牌活动 + public const CATEGORY_BRAND_ACTIVITY = 39; //关于我们 public const CATEGORY_COMPANY = 2; //物业服务 diff --git a/view/manager/article/add.html b/view/manager/article/add.html index 734fdd1..93a015d 100755 --- a/view/manager/article/add.html +++ b/view/manager/article/add.html @@ -192,6 +192,18 @@ + {if $category['id'] == 39} +
{$blocks['brand_activity']['value']}
+ {$blocks['brand_activity']['title']} +{$item.summary}
+ 查看详情 +{$blocks['event_preview']['value']}
+ {$blocks['event_preview']['title']} +{$prev.summary}
+ 查看详情 + Events +