|
...
|
...
|
@@ -312,7 +312,7 @@ class ProjectUpdate extends Command |
|
|
|
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
|
|
|
|
|
|
|
|
try {
|
|
|
|
$product = $model->read(['route' => $route], 'id');
|
|
|
|
$product = $model->read(['route' => $route], ['id', 'six_read']);
|
|
|
|
if (!$product) {
|
|
|
|
$id = $model->insertGetId([
|
|
|
|
'project_id' => $project_id,
|
|
...
|
...
|
@@ -338,60 +338,67 @@ class ProjectUpdate extends Command |
|
|
|
]);
|
|
|
|
$this->set_map($route, RouteMap::SOURCE_PRODUCT, $id, $project_id);
|
|
|
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PRODUCT, $id, $domain_arr['host'], $link_type, $language_list, $page_list);
|
|
|
|
$six_read = 1;
|
|
|
|
} else {
|
|
|
|
$id = $product['id'];
|
|
|
|
$model->edit([
|
|
|
|
'title' => $item['ttile'],
|
|
|
|
'intro' => $item['short_description'] ?? '',
|
|
|
|
'content' => $item['content'] ?? '',
|
|
|
|
'category_id' => $category_id,
|
|
|
|
'keyword_id' => $keyword_id,
|
|
|
|
'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '',
|
|
|
|
'gallery' => Arr::a2s($gallery),
|
|
|
|
'seo_mate' => Arr::a2s([
|
|
|
|
$six_read = $product['six_read'];
|
|
|
|
if ($six_read) {
|
|
|
|
//按5.0展示才需要更新数据
|
|
|
|
$model->edit([
|
|
|
|
'title' => $item['ttile'],
|
|
|
|
'keyword' => $item['keywords'] ?? '',
|
|
|
|
'description' => $item['description'] ?? ''
|
|
|
|
]),
|
|
|
|
'sort' => $item['sort'] ?? 0,
|
|
|
|
], ['id' => $id]);
|
|
|
|
'intro' => $item['short_description'] ?? '',
|
|
|
|
'content' => $item['content'] ?? '',
|
|
|
|
'category_id' => $category_id,
|
|
|
|
'keyword_id' => $keyword_id,
|
|
|
|
'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '',
|
|
|
|
'gallery' => Arr::a2s($gallery),
|
|
|
|
'seo_mate' => Arr::a2s([
|
|
|
|
'title' => $item['ttile'],
|
|
|
|
'keyword' => $item['keywords'] ?? '',
|
|
|
|
'description' => $item['description'] ?? ''
|
|
|
|
]),
|
|
|
|
'sort' => $item['sort'] ?? 0,
|
|
|
|
], ['id' => $id]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//关联分类
|
|
|
|
if ($category_arr) {
|
|
|
|
CategoryRelated::saveRelated($id, array_column($category_arr, 'id'));
|
|
|
|
}
|
|
|
|
if ($six_read) {
|
|
|
|
//关联分类
|
|
|
|
if ($$category_arr) {
|
|
|
|
CategoryRelated::saveRelated($id, array_column($category_arr, 'id'));
|
|
|
|
}
|
|
|
|
|
|
|
|
//扩展字段
|
|
|
|
if ($item['extend'] ?? []) {
|
|
|
|
foreach (array_reverse($item['extend']) as $ke => $ve) {
|
|
|
|
if ($ve == '--') {
|
|
|
|
$ve = '';
|
|
|
|
}
|
|
|
|
$extend = $extend_model->read(['title' => $ke]);
|
|
|
|
if (!$extend) {
|
|
|
|
$extend_key = $this->get_extend_key($extend_model);
|
|
|
|
$extend_model->add([
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'title' => $ke,
|
|
|
|
'type' => 1,
|
|
|
|
'key' => $extend_key
|
|
|
|
]);
|
|
|
|
} else {
|
|
|
|
$extend_key = $extend['key'];
|
|
|
|
}
|
|
|
|
//扩展字段
|
|
|
|
if ($item['extend'] ?? []) {
|
|
|
|
foreach (array_reverse($item['extend']) as $ke => $ve) {
|
|
|
|
if ($ve == '--') {
|
|
|
|
$ve = '';
|
|
|
|
}
|
|
|
|
$extend = $extend_model->read(['title' => $ke]);
|
|
|
|
if (!$extend) {
|
|
|
|
$extend_key = $this->get_extend_key($extend_model);
|
|
|
|
$extend_model->add([
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'title' => $ke,
|
|
|
|
'type' => 1,
|
|
|
|
'key' => $extend_key
|
|
|
|
]);
|
|
|
|
} else {
|
|
|
|
$extend_key = $extend['key'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$extend_info = $extend_info_model->read(['key' => $extend_key, 'product_id' => $id]);
|
|
|
|
if (!$extend_info) {
|
|
|
|
$extend_info_model->add([
|
|
|
|
'key' => $extend_key,
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'product_id' => $id,
|
|
|
|
'values' => $ve,
|
|
|
|
'type' => 1
|
|
|
|
]);
|
|
|
|
} else {
|
|
|
|
$extend_info_model->edit(['values' => $ve], ['key' => $extend_key, 'product_id' => $id]);
|
|
|
|
$extend_info = $extend_info_model->read(['key' => $extend_key, 'product_id' => $id]);
|
|
|
|
if (!$extend_info) {
|
|
|
|
$extend_info_model->add([
|
|
|
|
'key' => $extend_key,
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'product_id' => $id,
|
|
|
|
'values' => $ve,
|
|
|
|
'type' => 1
|
|
|
|
]);
|
|
|
|
} else {
|
|
|
|
$extend_info_model->edit(['values' => $ve], ['key' => $extend_key, 'product_id' => $id]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -448,7 +455,7 @@ class ProjectUpdate extends Command |
|
|
|
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
|
|
|
|
|
|
|
|
try {
|
|
|
|
$news = $model->read(['url' => $route], 'id');
|
|
|
|
$news = $model->read(['url' => $route], ['id', 'six_read']);
|
|
|
|
if (!$news) {
|
|
|
|
$id = $model->insertGetId([
|
|
|
|
'project_id' => $project_id,
|
|
...
|
...
|
@@ -472,16 +479,20 @@ class ProjectUpdate extends Command |
|
|
|
CollectTask::_insert($item['url'], $project_id, $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $domain_arr['host'], $link_type, $language_list, $page_list);
|
|
|
|
} else {
|
|
|
|
$id = $news['id'];
|
|
|
|
$model->edit([
|
|
|
|
'name' => $item['ttile'],
|
|
|
|
'category_id' => $category_id,
|
|
|
|
'seo_title' => $item['ttile'],
|
|
|
|
'seo_keywords' => $item['keywords'] ?? '',
|
|
|
|
'seo_description' => $item['description'] ?? '',
|
|
|
|
'text' => $item['content'] ?? '',
|
|
|
|
'image' => $new_img,
|
|
|
|
'sort' => $item['sort'] ?? 0,
|
|
|
|
], ['id' => $id]);
|
|
|
|
$six_read = $news['six_read'];
|
|
|
|
if ($six_read) {
|
|
|
|
//按5.0展示才需要更新数据
|
|
|
|
$model->edit([
|
|
|
|
'name' => $item['ttile'],
|
|
|
|
'category_id' => $category_id,
|
|
|
|
'seo_title' => $item['ttile'],
|
|
|
|
'seo_keywords' => $item['keywords'] ?? '',
|
|
|
|
'seo_description' => $item['description'] ?? '',
|
|
|
|
'text' => $item['content'] ?? '',
|
|
|
|
'image' => $new_img,
|
|
|
|
'sort' => $item['sort'] ?? 0,
|
|
|
|
], ['id' => $id]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
|
...
|
...
|
@@ -516,7 +527,7 @@ class ProjectUpdate extends Command |
|
|
|
//名称去掉特殊符号
|
|
|
|
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
|
|
|
|
try {
|
|
|
|
$custom = $model->read(['url' => $route], 'id');
|
|
|
|
$custom = $model->read(['url' => $route], ['id', 'six_read']);
|
|
|
|
if (!$custom) {
|
|
|
|
$id = $model->insertGetId([
|
|
|
|
'project_id' => $project_id,
|
|
...
|
...
|
@@ -537,13 +548,17 @@ class ProjectUpdate extends Command |
|
|
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PAGE, $id, $domain_arr['host'], $link_type, $language_list, $page_list);
|
|
|
|
} else {
|
|
|
|
$id = $custom['id'];
|
|
|
|
$model->edit([
|
|
|
|
'name' => $item['ttile'],
|
|
|
|
'title' => $item['ttile'],
|
|
|
|
'keywords' => $item['keywords'] ?? '',
|
|
|
|
'description' => $item['description'] ?? '',
|
|
|
|
'html' => $item['content'] ?? '',
|
|
|
|
], ['id' => $id]);
|
|
|
|
$six_read = $custom['six_read'];
|
|
|
|
if ($six_read) {
|
|
|
|
//按5.0展示才需要更新数据
|
|
|
|
$model->edit([
|
|
|
|
'name' => $item['ttile'],
|
|
|
|
'title' => $item['ttile'],
|
|
|
|
'keywords' => $item['keywords'] ?? '',
|
|
|
|
'description' => $item['description'] ?? '',
|
|
|
|
'html' => $item['content'] ?? '',
|
|
|
|
], ['id' => $id]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
|
...
|
...
|
@@ -632,7 +647,7 @@ class ProjectUpdate extends Command |
|
|
|
$item['title'] = $this->special2str($item['title'] ?? '');
|
|
|
|
|
|
|
|
try {
|
|
|
|
$custom_content = $model->read(['route' => $route], 'id');
|
|
|
|
$custom_content = $model->read(['route' => $route], ['id','six_read']);
|
|
|
|
if (!$custom_content) {
|
|
|
|
$id = $model->insertGetId([
|
|
|
|
'project_id' => $project_id,
|
|
...
|
...
|
@@ -651,50 +666,56 @@ class ProjectUpdate extends Command |
|
|
|
$this->set_map($route, RouteMap::SOURCE_MODULE, $id, $project_id);
|
|
|
|
|
|
|
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_MODULE, $id, $domain_arr['host'], $link_type, $language_list, $page_list);
|
|
|
|
$six_read = 1;
|
|
|
|
} else {
|
|
|
|
$id = $custom_content['id'];
|
|
|
|
$model->edit([
|
|
|
|
'name' => $item['title'],
|
|
|
|
'category_id' => $category_id,
|
|
|
|
'content' => $item['content'] ?? '',
|
|
|
|
'sort' => $item['sort'] ?? 0,
|
|
|
|
'image' => $new_img
|
|
|
|
], ['id' => $id]);
|
|
|
|
$six_read = $custom_content['six_read'];
|
|
|
|
if($six_read){
|
|
|
|
$model->edit([
|
|
|
|
'name' => $item['title'],
|
|
|
|
'category_id' => $category_id,
|
|
|
|
'content' => $item['content'] ?? '',
|
|
|
|
'sort' => $item['sort'] ?? 0,
|
|
|
|
'image' => $new_img
|
|
|
|
], ['id' => $id]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//扩展字段
|
|
|
|
if ($item['extend'] ?? []) {
|
|
|
|
foreach ($item['extend'] as $ke => $ve) {
|
|
|
|
$extend = $extend_model->read(['title' => $ke]);
|
|
|
|
if ($extend) {
|
|
|
|
if ($extend['type'] == 3) {
|
|
|
|
$gallery = [];
|
|
|
|
if (is_array($ve)) {
|
|
|
|
foreach ($ve as $ve_img) {
|
|
|
|
$gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve_img, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)];
|
|
|
|
if($six_read){
|
|
|
|
if ($item['extend'] ?? []) {
|
|
|
|
foreach ($item['extend'] as $ke => $ve) {
|
|
|
|
$extend = $extend_model->read(['title' => $ke]);
|
|
|
|
if ($extend) {
|
|
|
|
if ($extend['type'] == 3) {
|
|
|
|
$gallery = [];
|
|
|
|
if (is_array($ve)) {
|
|
|
|
foreach ($ve as $ve_img) {
|
|
|
|
$gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve_img, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)];
|
|
|
|
}
|
|
|
|
$value = Arr::a2s($gallery);
|
|
|
|
} elseif ($extend['type'] == 4) {
|
|
|
|
$value = Arr::a2s([$this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)]);
|
|
|
|
} else {
|
|
|
|
$gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)];
|
|
|
|
$value = $ve;
|
|
|
|
}
|
|
|
|
$value = Arr::a2s($gallery);
|
|
|
|
} elseif ($extend['type'] == 4) {
|
|
|
|
$value = Arr::a2s([$this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)]);
|
|
|
|
} else {
|
|
|
|
$value = $ve;
|
|
|
|
}
|
|
|
|
|
|
|
|
$extend_info = $extend_info_model->read(['key' => $extend['key'], 'content_id' => $id]);
|
|
|
|
if (!$extend_info) {
|
|
|
|
$extend_info_model->add([
|
|
|
|
'key' => $extend['key'],
|
|
|
|
'type' => $extend['type'],
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'content_id' => $id,
|
|
|
|
'module_id' => $custom_info['id'],
|
|
|
|
'values' => $value,
|
|
|
|
]);
|
|
|
|
} else {
|
|
|
|
$extend_info_model->edit(['type' => $extend['type'], 'values' => $value], ['key' => $extend['key'], 'content_id' => $id]);
|
|
|
|
$extend_info = $extend_info_model->read(['key' => $extend['key'], 'content_id' => $id]);
|
|
|
|
if (!$extend_info) {
|
|
|
|
$extend_info_model->add([
|
|
|
|
'key' => $extend['key'],
|
|
|
|
'type' => $extend['type'],
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'content_id' => $id,
|
|
|
|
'module_id' => $custom_info['id'],
|
|
|
|
'values' => $value,
|
|
|
|
]);
|
|
|
|
} else {
|
|
|
|
$extend_info_model->edit(['type' => $extend['type'], 'values' => $value], ['key' => $extend['key'], 'content_id' => $id]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
...
|
...
|
|