作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !1498
@@ -32,7 +32,23 @@ class CategoryController extends BaseController @@ -32,7 +32,23 @@ class CategoryController extends BaseController
32 $this->map = $this->searchParam(); 32 $this->map = $this->searchParam();
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 - $this->map['pid'] = $this->map['pid'] ?? 0; 35 + if($this->user['project_id'] == 3283){//分类太多加载失败
  36 + $list = $this->get3283Lists($category,$filed);
  37 + return $this->response('success',Code::SUCCESS,$list);
  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){
36 $list = $category->list($this->map,['sort','id'],$filed); 52 $list = $category->list($this->map,['sort','id'],$filed);
37 $data = []; 53 $data = [];
38 if(!empty($list)){ 54 if(!empty($list)){
@@ -44,9 +60,34 @@ class CategoryController extends BaseController @@ -44,9 +60,34 @@ class CategoryController extends BaseController
44 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']); 60 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
45 $list[$k] = $v; 61 $list[$k] = $v;
46 } 62 }
  63 + if(!isset($this->map['title'])){
  64 + $data = $this->getListSon($list);
  65 + }else{
47 $data = $list; 66 $data = $list;
48 } 67 }
49 - return $this->response('success',Code::SUCCESS,$data); 68 + }
  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;
  89 + }
  90 + return $this->success($list);
50 } 91 }
51 92
52 /** 93 /**