作者 lyh

gx

@@ -95,14 +95,14 @@ class DeleteProductCategory extends Command @@ -95,14 +95,14 @@ class DeleteProductCategory extends Command
95 * @time :2024/5/16 15:38 95 * @time :2024/5/16 15:38
96 */ 96 */
97 public function updateCategory(){ 97 public function updateCategory(){
98 - $productModel = new Product();  
99 $page = 1; 98 $page = 1;
100 while (true){ 99 while (true){
  100 + $productModel = new Product();
101 $productList = $productModel->lists(['status'=>1],$page,1000,'id',['id','category_id']); 101 $productList = $productModel->lists(['status'=>1],$page,1000,'id',['id','category_id']);
102 - if(empty($productList)){ 102 + if(empty($productList) || empty($productList['list'])){
103 return false; 103 return false;
104 } 104 }
105 - foreach ($productList as $v){ 105 + foreach ($productList['list'] as $v){
106 $categoryRelatedModel = new CategoryRelated(); 106 $categoryRelatedModel = new CategoryRelated();
107 if(empty($v['category_id'])){ 107 if(empty($v['category_id'])){
108 echo json_encode($v); 108 echo json_encode($v);