正在显示
1 个修改的文件
包含
30 行增加
和
5 行删除
| @@ -667,15 +667,20 @@ class BTemplateLogic extends BaseLogic | @@ -667,15 +667,20 @@ class BTemplateLogic extends BaseLogic | ||
| 667 | * @method :any | 667 | * @method :any |
| 668 | * @time :2023/7/17 16:03 | 668 | * @time :2023/7/17 16:03 |
| 669 | */ | 669 | */ |
| 670 | + /** | ||
| 671 | + * @remark :获取类型 | ||
| 672 | + * @name :getModuleType | ||
| 673 | + * @author :lyh | ||
| 674 | + * @method :any | ||
| 675 | + * @time :2023/7/17 16:03 | ||
| 676 | + */ | ||
| 670 | public function getModuleType(): array | 677 | public function getModuleType(): array |
| 671 | { | 678 | { |
| 672 | //定义数据结构 | 679 | //定义数据结构 |
| 673 | $data = $this->model->product_type; | 680 | $data = $this->model->product_type; |
| 674 | - //产品,新闻,博客,一级分类数据 | ||
| 675 | - $map = ['pid'=>0, 'project_id'=>$this->user['project_id']]; | ||
| 676 | - $productCategory = Category::where($map)->get(); | ||
| 677 | - $newCategory = NewsCategory::where($map)->get(); | ||
| 678 | - $blogCategory = BlogCategory::where($map)->get(); | 681 | + $productCategory = $this->getCategoryList((new Category()),1); |
| 682 | + $newCategory = $this->getCategoryList((new NewsCategory())); | ||
| 683 | + $blogCategory = $this->getCategoryList((new BlogCategory())); | ||
| 679 | if (!empty($productCategory)){ | 684 | if (!empty($productCategory)){ |
| 680 | foreach ($productCategory as $item){$data["products"]["category"][] =$item;} | 685 | foreach ($productCategory as $item){$data["products"]["category"][] =$item;} |
| 681 | } | 686 | } |
| @@ -690,6 +695,26 @@ class BTemplateLogic extends BaseLogic | @@ -690,6 +695,26 @@ class BTemplateLogic extends BaseLogic | ||
| 690 | } | 695 | } |
| 691 | 696 | ||
| 692 | /** | 697 | /** |
| 698 | + * @remark :获取1级+2级 | ||
| 699 | + * @name :getCategoryList | ||
| 700 | + * @author :lyh | ||
| 701 | + * @method :post | ||
| 702 | + * @time :2023/12/20 10:26 | ||
| 703 | + */ | ||
| 704 | + public function getCategoryList($categoryModel,$status = 0){ | ||
| 705 | + $data = array(); | ||
| 706 | + $list = $categoryModel->list(['pid'=>0,'status'=>$status]); | ||
| 707 | + foreach ($list as $v){ | ||
| 708 | + $data[] = $v; | ||
| 709 | + $son_list = $categoryModel->list(['pid'=>$v['id'],'status'=>$status]); | ||
| 710 | + foreach ($son_list as $v1){ | ||
| 711 | + $data[] = $v1; | ||
| 712 | + } | ||
| 713 | + } | ||
| 714 | + return $this->success($data); | ||
| 715 | + } | ||
| 716 | + | ||
| 717 | + /** | ||
| 693 | * @remark :保存html | 718 | * @remark :保存html |
| 694 | * @name :savePublicTemplateHtml | 719 | * @name :savePublicTemplateHtml |
| 695 | * @author :lyh | 720 | * @author :lyh |
-
请 注册 或 登录 后发表评论