diff --git a/app/controller/Page.php b/app/controller/Page.php index b721913..4cfb14f 100644 --- a/app/controller/Page.php +++ b/app/controller/Page.php @@ -33,30 +33,42 @@ class Page extends Base } else { $topCategory = Category::getById($TopCId); } - $childCategory = Category::getChildrenByParentId($category['id']); + $childCategory = Category::getChildrenByParentId($topCategory['id']); $this->data['topCategory'] = $topCategory; $this->data['childCategory'] = $childCategory; switch ($template) { case 'about' : - $this->assignAbout($topCategory, $category, $childCategory); + $this->assignAbout($childCategory); + break; + case 'service' : + $this->assignService($childCategory); break; default : } } - // 走进超宇 - private function assignAbout($topCategory, $category, $childCategory) + // 获取单页栏目IDs + private function getBlockCateIds($categoryItems) { - if(empty($childCategory)) { - $childCategory = Category::getChildrenByParentId($topCategory['id']); + $blockCateIds = []; + foreach ($categoryItems as $cate) { + if($cate['model_id'] == Model::PAGE) { + $blockCateIds[] = $cate['id']; + } } + return $blockCateIds; + } + + // 走进超宇 + private function assignAbout($childCategory) + { $honorTopCId = Category::$CIdList['honors_manage'] ?? 0; $historyCId = Category::$CIdList['history_manage'] ?? 0; $historyCate = Category::getById($historyCId); $honors = []; - $blockCateIds = []; $blocks = []; + $blockCateIds = $this->getBlockCateIds($childCategory); if($honorTopCId) { $honors = Category::getChildrenByParentId($honorTopCId); foreach ($honors as &$honor) { @@ -64,11 +76,6 @@ class Page extends Base } unset($honor); } - foreach ($childCategory as $cate) { - if($cate['model_id'] == Model::PAGE) { - $blockCateIds[] = $cate['id']; - } - } $blockList = Block::getByCategoryIds($blockCateIds); $aboutChildrenFlip = array_flip(Category::$CIdList['about_children']); foreach ($childCategory as $cate) { @@ -78,7 +85,19 @@ class Page extends Base $this->data['blocks'] = $blocks; $this->data['honors'] = $honors; $this->data['historyList'] = History::getByCategoryId($historyCId, true, $historyCate['number'] ?? -1); - //dump($this->data['honors']); - //dump($this->data['historyList']); + } + + // 品质与服务 + private function assignService($childCategory) + { + $blocks = []; + $blockCateIds = $this->getBlockCateIds($childCategory); + $blockList = Block::getByCategoryIds($blockCateIds); + $serviceChildrenFlip = array_flip(Category::$CIdList['service_children']); + foreach ($childCategory as $cate) { + $blocks[$serviceChildrenFlip[$cate['id']]] = $blockList[$cate['id']] ?? []; + } + + $this->data['blocks'] = $blocks; } } \ No newline at end of file diff --git a/app/model/Category.php b/app/model/Category.php index 5f71e5e..cef1d5e 100644 --- a/app/model/Category.php +++ b/app/model/Category.php @@ -15,7 +15,14 @@ class Category extends Base 'honors_manage' => 26, // 荣誉资质管理 'history_manage' => 29, // 发展历程管理 'products' => 2, // 产品中心 - 'marketing' => 15, // 网络营销(主) + 'products' => 2, // 产品中心 + 'products' => 2, // 产品中心 + 'service' => 5, // 品质与服务 + 'service_children' => [ + 'before' => 12, // 售前服务 + 'in_progress' => 13, // 售中服务 + 'after' => 14, // 售后服务 + ], 'marketing_children' => [ 'marketing_network' => 16, // 网络营销 'achievement' => 17, // 主要业绩 diff --git a/view/page/service.html b/view/page/service.html new file mode 100644 index 0000000..cbefa40 --- /dev/null +++ b/view/page/service.html @@ -0,0 +1,42 @@ +{layout name="layout"} + + +
+
+
+ {$topCategory.title} +

{:nl2br($topCategory.description ?? '')}

+
+
+
+ +
+
+
+
{$blocks['before']['title']['value'] ?? ''}

{:nl2br($blocks['before']['subtitle']['value'] ?? '')}

+
+ +
+
+
+
+
+
+
{$blocks['in_progress']['title']['value'] ?? ''}

{:nl2br($blocks['in_progress']['subtitle']['value'] ?? '')}

+
+ +
+
+
+
+
+
+
售后技术服务

After sales technology service

+
+
+ +
+
+
+
+
\ No newline at end of file