正在显示
1 个修改的文件
包含
45 行增加
和
21 行删除
| @@ -33,8 +33,25 @@ class CategoryController extends BaseController | @@ -33,8 +33,25 @@ 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); | 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){ | ||
| 52 | + $list = $category->list($this->map,['sort','id'],$filed); | ||
| 53 | + $data = []; | ||
| 54 | + if(!empty($list)){ | ||
| 38 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id | 55 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id |
| 39 | foreach ($list as $k =>$v){ | 56 | foreach ($list as $k =>$v){ |
| 40 | $v['url'] = $this->user['domain'] . $v['route'].'/'; | 57 | $v['url'] = $this->user['domain'] . $v['route'].'/'; |
| @@ -43,27 +60,34 @@ class CategoryController extends BaseController | @@ -43,27 +60,34 @@ class CategoryController extends BaseController | ||
| 43 | $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']); |
| 44 | $list[$k] = $v; | 61 | $list[$k] = $v; |
| 45 | } | 62 | } |
| 46 | - return $this->response('success',Code::SUCCESS,$list); | ||
| 47 | - }else{ | ||
| 48 | - $list = $category->list($this->map,['sort','id'],$filed); | ||
| 49 | - $data = []; | ||
| 50 | - if(!empty($list)){ | ||
| 51 | - $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id | ||
| 52 | - foreach ($list as $k =>$v){ | ||
| 53 | - $v['url'] = $this->user['domain'] . $v['route'].'/'; | ||
| 54 | - $v['product_num'] = $category->getProductNum($list,$v['id']); | ||
| 55 | - $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']); | ||
| 56 | - $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']); | ||
| 57 | - $list[$k] = $v; | ||
| 58 | - } | ||
| 59 | - if(!isset($this->map['title'])){ | ||
| 60 | - $data = $this->getListSon($list); | ||
| 61 | - }else{ | ||
| 62 | - $data = $list; | ||
| 63 | - } | 63 | + if(!isset($this->map['title'])){ |
| 64 | + $data = $this->getListSon($list); | ||
| 65 | + }else{ | ||
| 66 | + $data = $list; | ||
| 64 | } | 67 | } |
| 65 | - return $this->response('success',Code::SUCCESS,$data); | ||
| 66 | } | 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); | ||
| 67 | } | 91 | } |
| 68 | 92 | ||
| 69 | /** | 93 | /** |
-
请 注册 或 登录 后发表评论