作者 lyh

gx数据

@@ -54,7 +54,7 @@ class LyhImportTest extends Command @@ -54,7 +54,7 @@ class LyhImportTest extends Command
54 public function handle(){ 54 public function handle(){
55 ProjectServer::useProject(3283); 55 ProjectServer::useProject(3283);
56 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; 56 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
57 - $this->importProductCategory('https://ecdn6.globalso.com/upload/p/3283/file/2025-03/zy_boss_pricelistcat.csv',3283); 57 + $this->importProduct('https://ecdn6.globalso.com/upload/p/3283/file/2025-03/2-1.csv',3283);
58 DB::disconnect('custom_mysql'); 58 DB::disconnect('custom_mysql');
59 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 59 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
60 } 60 }
@@ -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,7 +78,12 @@ class CategoryController extends BaseController @@ -77,7 +78,12 @@ 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 = 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{
81 $list = $category->list($this->map,['sort','id'],$filed); 87 $list = $category->list($this->map,['sort','id'],$filed);
82 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id 88 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id
83 foreach ($list as $k =>$v){ 89 foreach ($list as $k =>$v){
@@ -87,6 +93,11 @@ class CategoryController extends BaseController @@ -87,6 +93,11 @@ class CategoryController extends BaseController
87 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']); 93 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
88 $list[$k] = $v; 94 $list[$k] = $v;
89 } 95 }
  96 + if(!isset($this->map['title'])){
  97 + $list = $this->getListSon($list);
  98 + }
  99 + Cache::put('category_list_'.$this->user['project_id'],$list,3600);
  100 + }
90 return $this->success($list); 101 return $this->success($list);
91 } 102 }
92 103