作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !126
... ... @@ -269,6 +269,7 @@ class ProjectUpdate extends Command
$new_category[] = $cate['id'];
}
}
if ($type_arr) {
$product_type = ',' . implode(',', $type_arr);
}
... ... @@ -277,21 +278,6 @@ class ProjectUpdate extends Command
$category_arr = $category_model->list(['original_id' => ['in', $new_category]]);
$category_id = $logic->getLastCategory(array_column($category_arr, 'id'));
}
// $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));
// }
}
try {
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
... ... @@ -323,30 +309,6 @@ 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 = '';
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 ($new_category) {
$category_arr = $category_model->list(['original_id' => ['in', $new_category]]);
$category_id = $logic->getLastCategory(array_column($category_arr, 'id'));
}
}
$model->edit(['category_id' => $category_id], ['id' => $product['id']]);
}
}
}
... ... @@ -559,18 +521,6 @@ class ProjectUpdate extends Command
}
}
//获取分类名称数组
protected function get_category_name_arr($category, $pid = 0)
{
foreach ($category as $k => $v) {
if ($v['parent'] == $pid) {
return $v;
}
}
return [];
}
//特殊字符转换
protected function special2str($str)
{
... ...