|
...
|
...
|
@@ -139,18 +139,16 @@ class ProjectUpdate extends Command |
|
|
|
'seo_title' => $item['seo_title'] ?? '',
|
|
|
|
'seo_keywords' => $item['seo_keywords'] ?? '',
|
|
|
|
'seo_description' => $item['seo_description'] ?? '',
|
|
|
|
'route' => $this->get_url_route($item['url'])
|
|
|
|
]);
|
|
|
|
$route = $this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $project_id);
|
|
|
|
$model->edit(['route' => $route], ['id' => $id]);
|
|
|
|
$this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $project_id);
|
|
|
|
|
|
|
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $link_type, $language_list, $page_list);
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$id = $keyword['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $link_type, $language_list, $page_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -271,19 +269,17 @@ class ProjectUpdate extends Command |
|
|
|
'keyword' => $item['keywords'] ?? '',
|
|
|
|
'description' => $item['description'] ?? ''
|
|
|
|
]),
|
|
|
|
'status' => Product::STATUS_ON
|
|
|
|
'status' => Product::STATUS_ON,
|
|
|
|
'route' => $this->get_url_route($item['url'])
|
|
|
|
]);
|
|
|
|
$route = $this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT, $id, $project_id);
|
|
|
|
$model->edit(['route' => $route], ['id' => $id]);
|
|
|
|
$this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT, $id, $project_id);
|
|
|
|
|
|
|
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PRODUCT, $id, $link_type, $language_list, $page_list);
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$id = $product['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PRODUCT, $id, $link_type, $language_list, $page_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -318,6 +314,15 @@ class ProjectUpdate extends Command |
|
|
|
if (!$news) {
|
|
|
|
try {
|
|
|
|
$item['ttile'] = $this->special2str($item['ttile']);
|
|
|
|
|
|
|
|
if (is_array($item['images'])) {
|
|
|
|
$image = $item['images'][0] ?? '';
|
|
|
|
} else {
|
|
|
|
$image = $item['images'] ?? '';
|
|
|
|
}
|
|
|
|
if(strpos($image,'//') === 0){
|
|
|
|
$image = 'https:'.$image;
|
|
|
|
}
|
|
|
|
$id = $model->addReturnId([
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'name' => $item['ttile'],
|
|
...
|
...
|
@@ -325,20 +330,18 @@ class ProjectUpdate extends Command |
|
|
|
'seo_keywords' => $item['keywords'] ?? '',
|
|
|
|
'seo_description' => $item['description'] ?? '',
|
|
|
|
'text' => $item['content'] ?? '',
|
|
|
|
'image' => $item['images'][0] ?? '',
|
|
|
|
'status' => $api_type == 'news' ? News::STATUS_ONE : Blog::STATUS_ONE
|
|
|
|
'image' => $image,
|
|
|
|
'status' => $api_type == 'news' ? News::STATUS_ONE : Blog::STATUS_ONE,
|
|
|
|
'url' => $this->get_url_route($item['url'])
|
|
|
|
]);
|
|
|
|
$route = $this->set_map($this->get_url_route($item['url']), $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $project_id);
|
|
|
|
$model->edit(['url' => $route], ['id' => $id]);
|
|
|
|
$this->set_map($this->get_url_route($item['url']), $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $project_id);
|
|
|
|
|
|
|
|
CollectTask::_insert($item['url'], $project_id, $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $link_type, $language_list, $page_list);
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$id = $news['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
CollectTask::_insert($item['url'], $project_id, $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $link_type, $language_list, $page_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -375,19 +378,17 @@ class ProjectUpdate extends Command |
|
|
|
'keywords' => $item['keywords'] ?? '',
|
|
|
|
'description' => $item['description'] ?? '',
|
|
|
|
'html' => $item['content'] ?? '',
|
|
|
|
'status' => 1
|
|
|
|
'status' => 1,
|
|
|
|
'url' => $this->get_url_route($item['url'])
|
|
|
|
]);
|
|
|
|
$route = $this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PAGE, $id, $project_id);
|
|
|
|
$model->edit(['url' => $route], ['id' => $id]);
|
|
|
|
$this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PAGE, $id, $project_id);
|
|
|
|
|
|
|
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PAGE, $id, $link_type, $language_list, $page_list);
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$id = $custom['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PAGE, $id, $link_type, $language_list, $page_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -463,10 +464,10 @@ class ProjectUpdate extends Command |
|
|
|
'title' => $item['name'],
|
|
|
|
'pid' => $pid,
|
|
|
|
'keywords' => $item['keywords'] ?? '',
|
|
|
|
'describe' => $item['description'] ?? ''
|
|
|
|
'describe' => $item['description'] ?? '',
|
|
|
|
'route' => $this->get_url_route($item['url'])
|
|
|
|
]);
|
|
|
|
$route = $this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT_CATE, $parent_id, $project_id);
|
|
|
|
$model->edit(['route' => $route], ['id' => $parent_id]);
|
|
|
|
$this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT_CATE, $parent_id, $project_id);
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
echo 'date:' . date('Y-m-d H:i:s') . ', category_insert error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
continue;
|
|
...
|
...
|
@@ -520,24 +521,23 @@ class ProjectUpdate extends Command |
|
|
|
//路由入库
|
|
|
|
protected function set_map($route, $source, $source_id, $project_id)
|
|
|
|
{
|
|
|
|
if (empty($route)) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
$route_map = new RouteMap();
|
|
|
|
$route_map->project_id = $project_id;
|
|
|
|
$route_map->source = $source;
|
|
|
|
$route_map->source_id = $source_id;
|
|
|
|
$route_map->route = $route;
|
|
|
|
if ($route) {
|
|
|
|
$route_map = RouteMap::where('project_id', $project_id)->where('source', $source)->where('source_id', $source_id)->first();
|
|
|
|
if (!$route_map) {
|
|
|
|
$route_map = new RouteMap();
|
|
|
|
$route_map->project_id = $project_id;
|
|
|
|
$route_map->source = $source;
|
|
|
|
$route_map->source_id = $source_id;
|
|
|
|
$route_map->route = $route;
|
|
|
|
|
|
|
|
if ($source == RouteMap::SOURCE_NEWS) {
|
|
|
|
$route_map->path = RouteMap::SOURCE_NEWS;
|
|
|
|
} elseif ($source == RouteMap::SOURCE_BLOG) {
|
|
|
|
$route_map->path = RouteMap::SOURCE_BLOG;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($source == RouteMap::SOURCE_NEWS) {
|
|
|
|
$route_map->path = RouteMap::SOURCE_NEWS;
|
|
|
|
} elseif ($source == RouteMap::SOURCE_BLOG) {
|
|
|
|
$route_map->path = RouteMap::SOURCE_BLOG;
|
|
|
|
$route_map->save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$route_map->save();
|
|
|
|
|
|
|
|
return $route;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|