|
...
|
...
|
@@ -268,30 +268,9 @@ class ProjectUpdate extends Command |
|
|
|
}
|
|
|
|
//分类
|
|
|
|
$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['id'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($type_arr) {
|
|
|
|
$product_type = ',' . implode(',', $type_arr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($new_category) {
|
|
|
|
$category_arr = $category_model->list(['original_id' => ['in', $new_category]]);
|
|
|
|
$category_id = $logic->getLastCategory(array_column($category_arr, 'id'));
|
|
|
|
}
|
|
|
|
$category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]);
|
|
|
|
$category_id = $logic->getLastCategory(array_column($category_arr, 'id'));
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
|
|
...
|
...
|
@@ -303,7 +282,6 @@ class ProjectUpdate extends Command |
|
|
|
'category_id' => $category_id,
|
|
|
|
'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '',
|
|
|
|
'gallery' => Arr::a2s($gallery),
|
|
|
|
'product_type' => $product_type,
|
|
|
|
'seo_mate' => Arr::a2s([
|
|
|
|
'title' => $item['ttile'],
|
|
|
|
'keyword' => $item['keywords'] ?? '',
|
|
...
|
...
|
@@ -325,6 +303,12 @@ class ProjectUpdate extends Command |
|
|
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($item['category'] ?? []) {
|
|
|
|
$category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]);
|
|
|
|
$category_id = $logic->getLastCategory(array_column($category_arr, 'id'));
|
|
|
|
$model->edit(['category_id', $category_id], ['id' => $product['id']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -467,7 +451,7 @@ class ProjectUpdate extends Command |
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
|
|
|
|
$task->status = UpdateLog::STATUS_COM;//同步完成
|
|
|
|
if($is_flush){
|
|
|
|
if ($is_flush) {
|
|
|
|
$task->collect_status = UpdateLog::COLLECT_STATUS_UN;
|
|
|
|
}
|
|
|
|
$task->save();
|
...
|
...
|
|