|
...
|
...
|
@@ -383,20 +383,12 @@ class ProjectUpdate extends Command |
|
|
|
'sort' => $item['sort'] ?? 0,
|
|
|
|
'files' => $files,
|
|
|
|
], ['id' => $id]);
|
|
|
|
} else {
|
|
|
|
//按6.0展示只更新分类
|
|
|
|
$model->edit([
|
|
|
|
'category_id' => $category_id
|
|
|
|
], ['id' => $id]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($six_read) {
|
|
|
|
//关联分类
|
|
|
|
if ($category_arr) {
|
|
|
|
CategoryRelated::saveRelated($id, array_column($category_arr, 'id'));
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($six_read) {
|
|
|
|
//扩展字段
|
|
|
|
if ($item['extend'] ?? []) {
|
|
|
|
foreach (array_reverse($item['extend']) as $ke => $ve) {
|
|
...
|
...
|
@@ -508,9 +500,7 @@ 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'];
|
|
|
|
$six_read = $news['six_read'];
|
|
|
|
if ($six_read) {
|
|
|
|
if ($news['six_read']) {
|
|
|
|
//按5.0展示才需要更新数据
|
|
|
|
$model->edit([
|
|
|
|
'name' => $item['ttile'],
|
|
...
|
...
|
@@ -522,7 +512,7 @@ class ProjectUpdate extends Command |
|
|
|
'image' => $new_img,
|
|
|
|
'release_at' => $item['post_date'] ?? date('Y-m-d H:i:s'),
|
|
|
|
'sort' => $item['sort'] ?? 0,
|
|
|
|
], ['id' => $id]);
|
|
|
|
], ['id' => $news['id']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (\Exception $e) {
|
|
...
|
...
|
@@ -855,9 +845,6 @@ class ProjectUpdate extends Command |
|
|
|
foreach ($items as $item) {
|
|
|
|
$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'] ?? '');
|
|
|
|
//图片
|
|
|
|
if (is_array($item['images'] ?? '')) {
|
|
...
|
...
|
@@ -867,9 +854,11 @@ class ProjectUpdate extends Command |
|
|
|
}
|
|
|
|
$new_img = $this->source_download($image, $project_id, $domain, $web_url_domain, $home_url);
|
|
|
|
//描述
|
|
|
|
$describe = '';
|
|
|
|
if (isset($item['description']) && $item['description']) {
|
|
|
|
$describe = $item['description'];
|
|
|
|
//匹配描述资源
|
|
|
|
$source_list = $this->html_preg($item['description'], $project_id, $domain, $web_url_domain, $home_url);
|
|
|
|
$source_list = $this->html_preg($describe, $project_id, $domain, $web_url_domain, $home_url);
|
|
|
|
if ($source_list) {
|
|
|
|
foreach ($source_list as $vs) {
|
|
|
|
if ($vs['download']) {
|
|
...
|
...
|
@@ -879,28 +868,39 @@ class ProjectUpdate extends Command |
|
|
|
//已经下载过资源
|
|
|
|
$down_url = getImageUrl($vs['url_complete']);
|
|
|
|
}
|
|
|
|
$item['description'] = str_replace($vs['url'], $down_url, $item['description']);
|
|
|
|
$describe = str_replace($vs['url'], $down_url, $describe);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
$parent = $model->read(['route' => $route], 'id');
|
|
|
|
if (!$parent) {
|
|
|
|
$parent_id = $model->addReturnId([
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'title' => $item['name'],
|
|
|
|
'image' => $new_img,
|
|
|
|
'pid' => $pid,
|
|
|
|
'keywords' => $item['keywords'] ?? '',
|
|
|
|
'describe' => (isset($item['description']) && $item['description']) ? $item['description'] : '',
|
|
|
|
'describe' => $describe,
|
|
|
|
'original_id' => $item['id'],
|
|
|
|
'route' => $route
|
|
|
|
]);
|
|
|
|
$this->set_map($route, RouteMap::SOURCE_PRODUCT_CATE, $parent_id, $project_id);
|
|
|
|
} else {
|
|
|
|
$parent_id = $parent['id'];
|
|
|
|
$model->edit([
|
|
|
|
'title' => $item['name'],
|
|
|
|
'image' => $new_img,
|
|
|
|
'pid' => $pid,
|
|
|
|
'keywords' => $item['keywords'] ?? '',
|
|
|
|
'describe' => $describe,
|
|
|
|
'original_id' => $item['id']
|
|
|
|
], ['id' => $parent_id]);
|
|
|
|
}
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
echo 'date:' . date('Y-m-d H:i:s') . ', category_insert error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$parent_id = $parent['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($item['children'] ?? [])) {
|
|
|
|
$this->category_insert($project_id, $item['children'], $parent_id, $domain, $web_url_domain, $home_url);
|
|
...
|
...
|
@@ -916,10 +916,10 @@ class ProjectUpdate extends Command |
|
|
|
foreach ($items as $item) {
|
|
|
|
$route = $this->get_url_route($item['url'] ?? '');
|
|
|
|
if ($route) {
|
|
|
|
$parent = $model->read(['pid' => $pid, 'alias' => $route], 'id');
|
|
|
|
if (!$parent) {
|
|
|
|
try {
|
|
|
|
$item['name'] = $this->special2str($item['name'] ?? '');
|
|
|
|
try {
|
|
|
|
$parent = $model->read(['alias' => $route], 'id');
|
|
|
|
if (!$parent) {
|
|
|
|
$parent_id = $model->addReturnId([
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'name' => $item['name'],
|
|
...
|
...
|
@@ -928,13 +928,19 @@ class ProjectUpdate extends Command |
|
|
|
'alias' => $route
|
|
|
|
]);
|
|
|
|
$this->set_map($route, RouteMap::SOURCE_NEWS_CATE, $parent_id, $project_id);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$parent_id = $parent['id'];
|
|
|
|
$model->edit([
|
|
|
|
'name' => $item['name'],
|
|
|
|
'pid' => $pid,
|
|
|
|
'original_id' => $item['id'],
|
|
|
|
], ['id' => $parent_id]);
|
|
|
|
}
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
echo 'date:' . date('Y-m-d H:i:s') . ', category_news_insert error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$parent_id = $parent['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($item['children'] ?? [])) {
|
|
|
|
$this->category_news_insert($project_id, $item['children'], $parent_id);
|
...
|
...
|
|