|
@@ -10,6 +10,7 @@ use App\Models\Product\Category; |
|
@@ -10,6 +10,7 @@ use App\Models\Product\Category; |
|
10
|
use App\Models\Template\BTemplate;
|
10
|
use App\Models\Template\BTemplate;
|
|
11
|
use App\Rules\Ids;
|
11
|
use App\Rules\Ids;
|
|
12
|
use Illuminate\Http\Request;
|
12
|
use Illuminate\Http\Request;
|
|
|
|
13
|
+use Illuminate\Support\Facades\Cache;
|
|
13
|
|
14
|
|
|
14
|
/**
|
15
|
/**
|
|
15
|
* Class CategoryController
|
16
|
* Class CategoryController
|
|
@@ -77,15 +78,25 @@ class CategoryController extends BaseController |
|
@@ -77,15 +78,25 @@ class CategoryController extends BaseController |
|
77
|
* @time :2025/3/19 14:38
|
78
|
* @time :2025/3/19 14:38
|
|
78
|
*/
|
79
|
*/
|
|
79
|
public function get3283Lists(&$category,$filed){
|
80
|
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;
|
81
|
+ $list = Cache::get('category_list_'.$this->user['project_id']);
|
|
|
|
82
|
+ if(!empty($list)){
|
|
|
|
83
|
+ if(!isset($this->map['title'])){
|
|
|
|
84
|
+ $list = $this->getListSon($list);
|
|
|
|
85
|
+ }
|
|
|
|
86
|
+ }else{
|
|
|
|
87
|
+ $list = $category->list($this->map,['sort','id'],$filed);
|
|
|
|
88
|
+ $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id
|
|
|
|
89
|
+ foreach ($list as $k =>$v){
|
|
|
|
90
|
+ $v['url'] = $this->user['domain'] . $v['route'].'/';
|
|
|
|
91
|
+ $v['product_num'] = $category->getProductNum($list,$v['id']);
|
|
|
|
92
|
+ $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']);
|
|
|
|
93
|
+ $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
|
|
|
|
94
|
+ $list[$k] = $v;
|
|
|
|
95
|
+ }
|
|
|
|
96
|
+ if(!isset($this->map['title'])){
|
|
|
|
97
|
+ $list = $this->getListSon($list);
|
|
|
|
98
|
+ }
|
|
|
|
99
|
+ Cache::put('category_list_'.$this->user['project_id'],$list,3600);
|
|
89
|
}
|
100
|
}
|
|
90
|
return $this->success($list);
|
101
|
return $this->success($list);
|
|
91
|
}
|
102
|
}
|