|
...
|
...
|
@@ -32,10 +32,9 @@ class CategoryController extends BaseController |
|
|
|
$this->map = $this->searchParam();
|
|
|
|
$filed = ['id', 'project_id', 'pid', 'title', 'image', 'route', 'status','created_at','sort'];
|
|
|
|
$this->map['deleted_at'] = null;
|
|
|
|
$this->map['pid'] = $this->map['pid'] ?? 0;
|
|
|
|
$list = $category->list($this->map,['sort','id'],$filed);
|
|
|
|
$data = [];
|
|
|
|
if(!empty($list)){
|
|
|
|
if($this->user['project_id'] == 3283){//分类太多加载失败
|
|
|
|
$this->map['pid'] = ($this->map['pid'] ?? 0);
|
|
|
|
$list = $category->list($this->map,['sort','id'],$filed);
|
|
|
|
$template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id
|
|
|
|
foreach ($list as $k =>$v){
|
|
|
|
$v['url'] = $this->user['domain'] . $v['route'].'/';
|
|
...
|
...
|
@@ -44,9 +43,27 @@ class CategoryController extends BaseController |
|
|
|
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
|
|
|
|
$list[$k] = $v;
|
|
|
|
}
|
|
|
|
$data = $list;
|
|
|
|
return $this->response('success',Code::SUCCESS,$list);
|
|
|
|
}else{
|
|
|
|
$list = $category->list($this->map,['sort','id'],$filed);
|
|
|
|
$data = [];
|
|
|
|
if(!empty($list)){
|
|
|
|
$template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id
|
|
|
|
foreach ($list as $k =>$v){
|
|
|
|
$v['url'] = $this->user['domain'] . $v['route'].'/';
|
|
|
|
$v['product_num'] = $category->getProductNum($list,$v['id']);
|
|
|
|
$v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']);
|
|
|
|
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
|
|
|
|
$list[$k] = $v;
|
|
|
|
}
|
|
|
|
if(!isset($this->map['title'])){
|
|
|
|
$data = $this->getListSon($list);
|
|
|
|
}else{
|
|
|
|
$data = $list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->response('success',Code::SUCCESS,$data);
|
|
|
|
}
|
|
|
|
return $this->response('success',Code::SUCCESS,$data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|