作者 lyh

gx

@@ -709,7 +709,7 @@ class BTemplateLogic extends BaseLogic @@ -709,7 +709,7 @@ class BTemplateLogic extends BaseLogic
709 $moduleModel = new CustomModule(); 709 $moduleModel = new CustomModule();
710 $moduleList = $moduleModel->list(['status'=>0]); 710 $moduleList = $moduleModel->list(['status'=>0]);
711 foreach ($moduleList as $v){ 711 foreach ($moduleList as $v){
712 - $moduleCategory = $this->getCategoryList((new CustomModuleCategory())); 712 + $moduleCategory = $this->getCategoryList((new CustomModuleCategory()),0,['id','name','pid']);
713 $categoryList = [["id"=>"all", "name"=>"全部"], ["id"=>"new", "name"=>"最新"]]; 713 $categoryList = [["id"=>"all", "name"=>"全部"], ["id"=>"new", "name"=>"最新"]];
714 foreach ($moduleCategory as $values){ 714 foreach ($moduleCategory as $values){
715 $categoryList[] = $values; 715 $categoryList[] = $values;
@@ -730,7 +730,7 @@ class BTemplateLogic extends BaseLogic @@ -730,7 +730,7 @@ class BTemplateLogic extends BaseLogic
730 foreach ($data as $key => $values){ 730 foreach ($data as $key => $values){
731 switch ($values['name']){ 731 switch ($values['name']){
732 case '产品': 732 case '产品':
733 - $productCategory = $this->getCategoryList((new Category()),1); 733 + $productCategory = $this->getCategoryList((new Category()),1,['id','title','pid']);
734 if(!empty($productCategory)){ 734 if(!empty($productCategory)){
735 foreach ($productCategory as $item){ 735 foreach ($productCategory as $item){
736 $values['category'][] = $item; 736 $values['category'][] = $item;
@@ -738,7 +738,7 @@ class BTemplateLogic extends BaseLogic @@ -738,7 +738,7 @@ class BTemplateLogic extends BaseLogic
738 } 738 }
739 break; 739 break;
740 case '新闻': 740 case '新闻':
741 - $newCategory = $this->getCategoryList((new NewsCategory())); 741 + $newCategory = $this->getCategoryList((new NewsCategory()),0,['id','name','pid']);
742 if(!empty($newCategory)){ 742 if(!empty($newCategory)){
743 foreach ($newCategory as $item){ 743 foreach ($newCategory as $item){
744 $values['category'][] = $item; 744 $values['category'][] = $item;
@@ -746,7 +746,7 @@ class BTemplateLogic extends BaseLogic @@ -746,7 +746,7 @@ class BTemplateLogic extends BaseLogic
746 } 746 }
747 break; 747 break;
748 case '博客': 748 case '博客':
749 - $blogCategory = $this->getCategoryList((new BlogCategory())); 749 + $blogCategory = $this->getCategoryList((new BlogCategory()),0,['id','name','pid']);
750 if(!empty($blogCategory)){ 750 if(!empty($blogCategory)){
751 foreach ($blogCategory as $item){ 751 foreach ($blogCategory as $item){
752 $values['category'][] = $item; 752 $values['category'][] = $item;
@@ -768,12 +768,12 @@ class BTemplateLogic extends BaseLogic @@ -768,12 +768,12 @@ class BTemplateLogic extends BaseLogic
768 * @method :post 768 * @method :post
769 * @time :2023/12/20 10:26 769 * @time :2023/12/20 10:26
770 */ 770 */
771 - public function getCategoryList($categoryModel,$status = 0){ 771 + public function getCategoryList($categoryModel,$status = 0,$filed = ['*']){
772 $data = array(); 772 $data = array();
773 - $list = $categoryModel->list(['pid'=>0,'status'=>$status]); 773 + $list = $categoryModel->list(['pid'=>0,'status'=>$status],['sort','id'],$filed);
774 foreach ($list as $v){ 774 foreach ($list as $v){
775 $data[] = $v; 775 $data[] = $v;
776 - $son_list = $categoryModel->list(['pid'=>$v['id'],'status'=>$status]); 776 + $son_list = $categoryModel->list(['pid'=>$v['id'],'status'=>$status],['sort','id'],$filed);
777 foreach ($son_list as $v1){ 777 foreach ($son_list as $v1){
778 $data[] = $v1; 778 $data[] = $v1;
779 } 779 }