正在显示
1 个修改的文件
包含
12 行增加
和
8 行删除
| @@ -168,15 +168,19 @@ class UpdateRoute extends Command | @@ -168,15 +168,19 @@ 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]); | ||
| 172 | - foreach ($list as $k => $v){ | ||
| 173 | - if(empty($v['category_id'])){ | ||
| 174 | - continue; | 171 | + $num = 5; |
| 172 | + while ($num > 0){ | ||
| 173 | + $list = $product->lists(['status'=>1],$num,5000); | ||
| 174 | + foreach ($list as $k => $v){ | ||
| 175 | + if(empty($v['category_id'])){ | ||
| 176 | + continue; | ||
| 177 | + } | ||
| 178 | + $category_ids = $v['category_id']; | ||
| 179 | + //产品分类关联 | ||
| 180 | + $this->saveRelated($v['id'], $category_ids); | ||
| 181 | + echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL; | ||
| 175 | } | 182 | } |
| 176 | - $category_ids = $v['category_id']; | ||
| 177 | - //产品分类关联 | ||
| 178 | - $this->saveRelated($v['id'], $category_ids); | ||
| 179 | - echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL; | 183 | + $num--; |
| 180 | } | 184 | } |
| 181 | } | 185 | } |
| 182 | 186 |
-
请 注册 或 登录 后发表评论