|
...
|
...
|
@@ -33,8 +33,25 @@ class CategoryController extends BaseController |
|
|
|
$filed = ['id', 'project_id', 'pid', 'title', 'image', 'route', 'status','created_at','sort'];
|
|
|
|
$this->map['deleted_at'] = null;
|
|
|
|
if($this->user['project_id'] == 3283){//分类太多加载失败
|
|
|
|
$this->map['pid'] = ($this->map['pid'] ?? 0);
|
|
|
|
$list = $category->list($this->map,['sort','id'],$filed);
|
|
|
|
$list = $this->get3283Lists($category,$filed);
|
|
|
|
return $this->response('success',Code::SUCCESS,$list);
|
|
|
|
}else{
|
|
|
|
$data = $this->getList($category,$filed);
|
|
|
|
return $this->response('success',Code::SUCCESS,$data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取项目列表
|
|
|
|
* @name :getList
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/3/19 14:41
|
|
|
|
*/
|
|
|
|
public function getList(&$category,$filed){
|
|
|
|
$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'].'/';
|
|
...
|
...
|
@@ -43,27 +60,34 @@ class CategoryController extends BaseController |
|
|
|
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
|
|
|
|
$list[$k] = $v;
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
if(!isset($this->map['title'])){
|
|
|
|
$data = $this->getListSon($list);
|
|
|
|
}else{
|
|
|
|
$data = $list;
|
|
|
|
}
|
|
|
|
return $this->response('success',Code::SUCCESS,$data);
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :特殊项目特殊处理
|
|
|
|
* @name :get3283Lists
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/3/19 14:38
|
|
|
|
*/
|
|
|
|
public function get3283Lists(&$category,$filed){
|
|
|
|
$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'].'/';
|
|
|
|
$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;
|
|
|
|
}
|
|
|
|
return $this->success($list);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|