|
...
|
...
|
@@ -263,7 +263,7 @@ class ProjectUpdate extends Command |
|
|
|
$type_arr[] = 2;
|
|
|
|
} elseif ($cate['parent'] == 0 && $cate['name'] == 'Hot Products') {
|
|
|
|
$type_arr[] = 3;
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
$new_category[] = $cate;
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -316,6 +316,45 @@ class ProjectUpdate extends Command |
|
|
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//分类
|
|
|
|
$category_id = '';
|
|
|
|
//产品类型,2Featured Products,3Hot Products
|
|
|
|
$product_type = '';
|
|
|
|
|
|
|
|
if ($item['category'] ?? []) {
|
|
|
|
$type_arr = [];
|
|
|
|
$new_category = [];
|
|
|
|
foreach ($item['category'] as $cate) {
|
|
|
|
if ($cate['parent'] == 0 && $cate['name'] == 'Featured Products') {
|
|
|
|
$type_arr[] = 2;
|
|
|
|
} elseif ($cate['parent'] == 0 && $cate['name'] == 'Hot Products') {
|
|
|
|
$type_arr[] = 3;
|
|
|
|
} else {
|
|
|
|
$new_category[] = $cate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($type_arr) {
|
|
|
|
$product_type = ',' . implode(',', $type_arr);
|
|
|
|
}
|
|
|
|
|
|
|
|
$category_arr = [];
|
|
|
|
$pid = 0;
|
|
|
|
for ($i = 0; $i < count($new_category); $i++) {
|
|
|
|
$return = $this->get_category_name_arr($new_category, $pid);
|
|
|
|
if ($return) {
|
|
|
|
$category_arr[] = $this->special2str($return['name'] ?? '');
|
|
|
|
$pid = $return['id'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($category_arr) {
|
|
|
|
$categoryLogic = new CategoryLogic();
|
|
|
|
$category_id = $categoryLogic->importProductCategory($project_id, implode('/', $category_arr));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$model->edit(['category_id' => $category_id, 'product_type' => $product_type], ['id' => $product['id']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
...
|
...
|
|