正在显示
1 个修改的文件
包含
23 行增加
和
6 行删除
| @@ -32,10 +32,9 @@ class CategoryController extends BaseController | @@ -32,10 +32,9 @@ 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; | ||
| 36 | - $list = $category->list($this->map,['sort','id'],$filed); | ||
| 37 | - $data = []; | ||
| 38 | - if(!empty($list)){ | 35 | + if($this->user['project_id'] == 3283){//分类太多加载失败 |
| 36 | + $this->map['pid'] = ($this->map['pid'] ?? 0); | ||
| 37 | + $list = $category->list($this->map,['sort','id'],$filed); | ||
| 39 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id | 38 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id |
| 40 | foreach ($list as $k =>$v){ | 39 | foreach ($list as $k =>$v){ |
| 41 | $v['url'] = $this->user['domain'] . $v['route'].'/'; | 40 | $v['url'] = $this->user['domain'] . $v['route'].'/'; |
| @@ -44,9 +43,27 @@ class CategoryController extends BaseController | @@ -44,9 +43,27 @@ class CategoryController extends BaseController | ||
| 44 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']); | 43 | $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']); |
| 45 | $list[$k] = $v; | 44 | $list[$k] = $v; |
| 46 | } | 45 | } |
| 47 | - $data = $list; | 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 | + } | ||
| 64 | + } | ||
| 65 | + return $this->response('success',Code::SUCCESS,$data); | ||
| 48 | } | 66 | } |
| 49 | - return $this->response('success',Code::SUCCESS,$data); | ||
| 50 | } | 67 | } |
| 51 | 68 | ||
| 52 | /** | 69 | /** |
-
请 注册 或 登录 后发表评论