作者 lyh

gx数据

@@ -33,18 +33,22 @@ class CategoryController extends BaseController @@ -33,18 +33,22 @@ class CategoryController extends BaseController
33 $filed = ['id', 'project_id', 'pid', 'title', 'image', 'route', 'status','created_at','sort']; 33 $filed = ['id', 'project_id', 'pid', 'title', 'image', 'route', 'status','created_at','sort'];
34 $this->map['deleted_at'] = null; 34 $this->map['deleted_at'] = null;
35 if($this->user['project_id'] == 3283){//分类太多加载失败 35 if($this->user['project_id'] == 3283){//分类太多加载失败
36 - $this->map['pid'] = ($this->map['pid'] ?? 0);  
37 - $list = $category->list($this->map,['sort','id'],$filed);  
38 - $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id  
39 - foreach ($list as $k =>$v){  
40 - $v['url'] = $this->user['domain'] . $v['route'].'/';  
41 - $v['product_num'] = $category->getProductNum($list,$v['id']);  
42 - $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']);  
43 - $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);  
44 - $list[$k] = $v;  
45 - } 36 + $list = $this->get3283Lists($category,$filed);
46 return $this->response('success',Code::SUCCESS,$list); 37 return $this->response('success',Code::SUCCESS,$list);
47 }else{ 38 }else{
  39 + $data = $this->getList($category,$filed);
  40 + return $this->response('success',Code::SUCCESS,$data);
  41 + }
  42 + }
  43 +
  44 + /**
  45 + * @remark :获取项目列表
  46 + * @name :getList
  47 + * @author :lyh
  48 + * @method :post
  49 + * @time :2025/3/19 14:41
  50 + */
  51 + public function getList(&$category,$filed){
48 $list = $category->list($this->map,['sort','id'],$filed); 52 $list = $category->list($this->map,['sort','id'],$filed);
49 $data = []; 53 $data = [];
50 if(!empty($list)){ 54 if(!empty($list)){
@@ -62,8 +66,28 @@ class CategoryController extends BaseController @@ -62,8 +66,28 @@ class CategoryController extends BaseController
62 $data = $list; 66 $data = $list;
63 } 67 }
64 } 68 }
65 - return $this->response('success',Code::SUCCESS,$data); 69 + return $this->success($data);
  70 + }
  71 +
  72 + /**
  73 + * @remark :特殊项目特殊处理
  74 + * @name :get3283Lists
  75 + * @author :lyh
  76 + * @method :post
  77 + * @time :2025/3/19 14:38
  78 + */
  79 + public function get3283Lists(&$category,$filed){
  80 + $this->map['pid'] = ($this->map['pid'] ?? 0);
  81 + $list = $category->list($this->map,['sort','id'],$filed);
  82 + $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id
  83 + foreach ($list as $k =>$v){
  84 + $v['url'] = $this->user['domain'] . $v['route'].'/';
  85 + $v['product_num'] = $category->getProductNum($list,$v['id']);
  86 + $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']);
  87 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
  88 + $list[$k] = $v;
66 } 89 }
  90 + return $this->success($list);
67 } 91 }
68 92
69 /** 93 /**