作者 lyh

gx

... ... @@ -671,11 +671,9 @@ class BTemplateLogic extends BaseLogic
{
//定义数据结构
$data = $this->model->product_type;
//产品,新闻,博客,一级分类数据
$map = ['pid'=>0, 'project_id'=>$this->user['project_id']];
$productCategory = Category::where($map)->get();
$newCategory = NewsCategory::where($map)->get();
$blogCategory = BlogCategory::where($map)->get();
$productCategory = $this->getCategoryList((new Category()));
$newCategory = $this->getCategoryList((new NewsCategory()));
$blogCategory = $this->getCategoryList((new BlogCategory()));
if (!empty($productCategory)){
foreach ($productCategory as $item){$data["products"]["category"][] =$item;}
}
... ... @@ -690,6 +688,26 @@ class BTemplateLogic extends BaseLogic
}
/**
* @remark :获取1级+2级
* @name :getCategoryList
* @author :lyh
* @method :post
* @time :2023/12/20 10:26
*/
public function getCategoryList($categoryModel){
$data = array();
$list = $categoryModel->list(['pid'=>0,'status'=>1]);
foreach ($list as $v){
$data[] = $v;
$son_list = $categoryModel->list(['pid'=>$v['id'],'status'=>1]);
foreach ($son_list as $v1){
$data[] = $v1;
}
}
return $this->success($data);
}
/**
* @remark :保存html
* @name :savePublicTemplateHtml
* @author :lyh
... ...