作者 lyh

gx

... ... @@ -168,15 +168,19 @@ class UpdateRoute extends Command
*/
public function getProductCategory(){
$product = new Product();
$list = $product->list(['status'=>1]);
foreach ($list as $k => $v){
if(empty($v['category_id'])){
continue;
$num = 5;
while ($num > 0){
$list = $product->lists(['status'=>1],$num,5000);
foreach ($list as $k => $v){
if(empty($v['category_id'])){
continue;
}
$category_ids = $v['category_id'];
//产品分类关联
$this->saveRelated($v['id'], $category_ids);
echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;
}
$category_ids = $v['category_id'];
//产品分类关联
$this->saveRelated($v['id'], $category_ids);
echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;
$num--;
}
}
... ...