作者 lyh

gx

@@ -168,7 +168,9 @@ class UpdateRoute extends Command @@ -168,7 +168,9 @@ class UpdateRoute extends Command
168 */ 168 */
169 public function getProductCategory(){ 169 public function getProductCategory(){
170 $product = new Product(); 170 $product = new Product();
171 - $list = $product->list(['status'=>1]); 171 + $num = 5;
  172 + while ($num > 0){
  173 + $list = $product->lists(['status'=>1],$num,5000);
172 foreach ($list as $k => $v){ 174 foreach ($list as $k => $v){
173 if(empty($v['category_id'])){ 175 if(empty($v['category_id'])){
174 continue; 176 continue;
@@ -178,6 +180,8 @@ class UpdateRoute extends Command @@ -178,6 +180,8 @@ class UpdateRoute extends Command
178 $this->saveRelated($v['id'], $category_ids); 180 $this->saveRelated($v['id'], $category_ids);
179 echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL; 181 echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;
180 } 182 }
  183 + $num--;
  184 + }
181 } 185 }
182 186
183 /** 187 /**