|
...
|
...
|
@@ -122,7 +122,7 @@ class ProjectUpdate extends Command |
|
|
|
$data = curl_c($url);
|
|
|
|
if (isset($data['code']) && $data['code'] == 200) {
|
|
|
|
$items = $data['data'] ?? [];
|
|
|
|
$this->category_insert($project_id, $items, 0);
|
|
|
|
$this->category_insert($project_id, $items, 0, $domain_arr['host'], $web_url_domain, $home_url);
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
...
|
...
|
@@ -737,7 +737,7 @@ class ProjectUpdate extends Command |
|
|
|
}
|
|
|
|
|
|
|
|
//产品多级分类入库
|
|
|
|
protected function category_insert($project_id, $items, $pid = 0)
|
|
|
|
protected function category_insert($project_id, $items, $pid, $domain, $web_url_domain, $home_url)
|
|
|
|
{
|
|
|
|
$model = new Category();
|
|
|
|
foreach ($items as $item) {
|
|
...
|
...
|
@@ -747,9 +747,17 @@ class ProjectUpdate extends Command |
|
|
|
if (!$parent) {
|
|
|
|
try {
|
|
|
|
$item['name'] = $this->special2str($item['name'] ?? '');
|
|
|
|
//图片
|
|
|
|
if (is_array($item['images'] ?? '')) {
|
|
|
|
$image = $item['images'][0] ?? '';
|
|
|
|
} else {
|
|
|
|
$image = $item['images'] ?? '';
|
|
|
|
}
|
|
|
|
$new_img = $this->source_download($image, $project_id, $domain, $web_url_domain, $home_url);
|
|
|
|
$parent_id = $model->addReturnId([
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'title' => $item['name'],
|
|
|
|
'image' => $new_img,
|
|
|
|
'pid' => $pid,
|
|
|
|
'keywords' => $item['keywords'] ?? '',
|
|
|
|
'describe' => $item['description'] ?? '',
|
|
...
|
...
|
@@ -766,7 +774,7 @@ class ProjectUpdate extends Command |
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($item['children'] ?? [])) {
|
|
|
|
$this->category_insert($project_id, $item['children'], $parent_id);
|
|
|
|
$this->category_insert($project_id, $item['children'], $parent_id, $domain, $web_url_domain, $home_url);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
...
|
...
|
|