|
...
|
...
|
@@ -128,20 +128,21 @@ class ProjectUpdate extends Command |
|
|
|
|
|
|
|
$model = new Keyword();
|
|
|
|
foreach ($items as $item) {
|
|
|
|
if ($item['name'] ?? '') {
|
|
|
|
$keyword = $model->read(['title' => $item['name']], 'id');
|
|
|
|
$route = $this->get_url_route($item['url'] ?? '');
|
|
|
|
if ($route) {
|
|
|
|
$keyword = $model->read(['route' => $route], 'id');
|
|
|
|
if (!$keyword) {
|
|
|
|
try {
|
|
|
|
$item['name'] = $this->special2str($item['name']);
|
|
|
|
$item['name'] = $this->special2str($item['name'] ?? '');
|
|
|
|
$id = $model->addReturnId([
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'title' => $item['name'],
|
|
|
|
'seo_title' => $item['seo_title'] ?? '',
|
|
|
|
'seo_keywords' => $item['seo_keywords'] ?? '',
|
|
|
|
'seo_description' => $item['seo_description'] ?? '',
|
|
|
|
'route' => $this->get_url_route($item['url'])
|
|
|
|
'route' => $route
|
|
|
|
]);
|
|
|
|
$this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $project_id);
|
|
|
|
$this->set_map($route, 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) {
|
|
...
|
...
|
@@ -225,8 +226,9 @@ class ProjectUpdate extends Command |
|
|
|
$model = new Product();
|
|
|
|
|
|
|
|
foreach ($items as $item) {
|
|
|
|
if ($item['ttile'] ?? '') {
|
|
|
|
$product = $model->read(['title' => $item['ttile']], 'id');
|
|
|
|
$route = $this->get_url_route($item['url'] ?? '');
|
|
|
|
if ($route) {
|
|
|
|
$product = $model->read(['route' => $route], 'id');
|
|
|
|
if (!$product) {
|
|
|
|
//图片
|
|
|
|
$gallery = [];
|
|
...
|
...
|
@@ -244,7 +246,7 @@ class ProjectUpdate extends Command |
|
|
|
for ($i = 0; $i < count($item['category']); $i++) {
|
|
|
|
$return = $this->get_category_name_arr($item['category'], $pid);
|
|
|
|
if ($return) {
|
|
|
|
$category_arr[] = $this->special2str($return['name']);
|
|
|
|
$category_arr[] = $this->special2str($return['name'] ?? '');
|
|
|
|
$pid = $return['id'];
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -255,7 +257,7 @@ class ProjectUpdate extends Command |
|
|
|
}
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
$item['ttile'] = $this->special2str($item['ttile']);
|
|
|
|
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
|
|
|
|
$id = $model->addReturnId([
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'title' => $item['ttile'],
|
|
...
|
...
|
@@ -270,9 +272,9 @@ class ProjectUpdate extends Command |
|
|
|
'description' => $item['description'] ?? ''
|
|
|
|
]),
|
|
|
|
'status' => Product::STATUS_ON,
|
|
|
|
'route' => $this->get_url_route($item['url'])
|
|
|
|
'route' => $route
|
|
|
|
]);
|
|
|
|
$this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT, $id, $project_id);
|
|
|
|
$this->set_map($route, 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) {
|
|
...
|
...
|
@@ -308,12 +310,12 @@ class ProjectUpdate extends Command |
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($items as $item) {
|
|
|
|
$route = $this->get_url_route($item['url']);
|
|
|
|
$route = $this->get_url_route($item['url'] ?? '');
|
|
|
|
if ($route) {
|
|
|
|
$news = $model->read(['url' => $route], 'id');
|
|
|
|
if (!$news) {
|
|
|
|
try {
|
|
|
|
$item['ttile'] = $this->special2str($item['ttile']);
|
|
|
|
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
|
|
|
|
|
|
|
|
if (is_array($item['images'])) {
|
|
|
|
$image = $item['images'][0] ?? '';
|
|
...
|
...
|
@@ -366,11 +368,12 @@ class ProjectUpdate extends Command |
|
|
|
$model = new BCustomTemplate();
|
|
|
|
|
|
|
|
foreach ($items as $item) {
|
|
|
|
if ($item['ttile'] ?? '') {
|
|
|
|
$custom = $model->read(['name' => $item['ttile']], 'id');
|
|
|
|
$route = $this->get_url_route($item['url'] ?? '');
|
|
|
|
if ($route) {
|
|
|
|
$custom = $model->read(['url' => $route], 'id');
|
|
|
|
if (!$custom) {
|
|
|
|
try {
|
|
|
|
$item['ttile'] = $this->special2str($item['ttile']);
|
|
|
|
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
|
|
|
|
$id = $model->addReturnId([
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'name' => $item['ttile'],
|
|
...
|
...
|
@@ -379,9 +382,9 @@ class ProjectUpdate extends Command |
|
|
|
'description' => $item['description'] ?? '',
|
|
|
|
'html' => $item['content'] ?? '',
|
|
|
|
'status' => 1,
|
|
|
|
'url' => $this->get_url_route($item['url'])
|
|
|
|
'url' => $route
|
|
|
|
]);
|
|
|
|
$this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PAGE, $id, $project_id);
|
|
|
|
$this->set_map($route, 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) {
|
|
...
|
...
|
@@ -454,20 +457,21 @@ class ProjectUpdate extends Command |
|
|
|
{
|
|
|
|
$model = new Category();
|
|
|
|
foreach ($items as $item) {
|
|
|
|
if ($item['name'] ?? '') {
|
|
|
|
$parent = $model->read(['pid' => $pid, 'title' => $item['name']], 'id');
|
|
|
|
$route = $this->get_url_route($item['url'] ?? '');
|
|
|
|
if ($route) {
|
|
|
|
$parent = $model->read(['pid' => $pid, 'route' => $route], 'id');
|
|
|
|
if (!$parent) {
|
|
|
|
try {
|
|
|
|
$item['name'] = $this->special2str($item['name']);
|
|
|
|
$item['name'] = $this->special2str($item['name'] ?? '');
|
|
|
|
$parent_id = $model->addReturnId([
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'title' => $item['name'],
|
|
|
|
'pid' => $pid,
|
|
|
|
'keywords' => $item['keywords'] ?? '',
|
|
|
|
'describe' => $item['description'] ?? '',
|
|
|
|
'route' => $this->get_url_route($item['url'])
|
|
|
|
'route' => $route
|
|
|
|
]);
|
|
|
|
$this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT_CATE, $parent_id, $project_id);
|
|
|
|
$this->set_map($route, 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;
|
...
|
...
|
|