作者 lyh

gx

... ... @@ -709,7 +709,7 @@ class BTemplateLogic extends BaseLogic
$moduleModel = new CustomModule();
$moduleList = $moduleModel->list(['status'=>0]);
foreach ($moduleList as $v){
$moduleCategory = $this->getCategoryList((new CustomModuleCategory()));
$moduleCategory = $this->getCategoryList((new CustomModuleCategory()),0,['id','name','pid']);
$categoryList = [["id"=>"all", "name"=>"全部"], ["id"=>"new", "name"=>"最新"]];
foreach ($moduleCategory as $values){
$categoryList[] = $values;
... ... @@ -730,7 +730,7 @@ class BTemplateLogic extends BaseLogic
foreach ($data as $key => $values){
switch ($values['name']){
case '产品':
$productCategory = $this->getCategoryList((new Category()),1);
$productCategory = $this->getCategoryList((new Category()),1,['id','title','pid']);
if(!empty($productCategory)){
foreach ($productCategory as $item){
$values['category'][] = $item;
... ... @@ -738,7 +738,7 @@ class BTemplateLogic extends BaseLogic
}
break;
case '新闻':
$newCategory = $this->getCategoryList((new NewsCategory()));
$newCategory = $this->getCategoryList((new NewsCategory()),0,['id','name','pid']);
if(!empty($newCategory)){
foreach ($newCategory as $item){
$values['category'][] = $item;
... ... @@ -746,7 +746,7 @@ class BTemplateLogic extends BaseLogic
}
break;
case '博客':
$blogCategory = $this->getCategoryList((new BlogCategory()));
$blogCategory = $this->getCategoryList((new BlogCategory()),0,['id','name','pid']);
if(!empty($blogCategory)){
foreach ($blogCategory as $item){
$values['category'][] = $item;
... ... @@ -768,12 +768,12 @@ class BTemplateLogic extends BaseLogic
* @method :post
* @time :2023/12/20 10:26
*/
public function getCategoryList($categoryModel,$status = 0){
public function getCategoryList($categoryModel,$status = 0,$filed = ['*']){
$data = array();
$list = $categoryModel->list(['pid'=>0,'status'=>$status]);
$list = $categoryModel->list(['pid'=>0,'status'=>$status],['sort','id'],$filed);
foreach ($list as $v){
$data[] = $v;
$son_list = $categoryModel->list(['pid'=>$v['id'],'status'=>$status]);
$son_list = $categoryModel->list(['pid'=>$v['id'],'status'=>$status],['sort','id'],$filed);
foreach ($son_list as $v1){
$data[] = $v1;
}
... ...