作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !505
... ... @@ -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,8 +338,12 @@ 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'];
$six_read = $product['six_read'];
if ($six_read) {
//按5.0展示才需要更新数据
$model->edit([
'title' => $item['ttile'],
'intro' => $item['short_description'] ?? '',
... ... @@ -356,9 +360,11 @@ class ProjectUpdate extends Command
'sort' => $item['sort'] ?? 0,
], ['id' => $id]);
}
}
if ($six_read) {
//关联分类
if ($category_arr) {
if ($$category_arr) {
CategoryRelated::saveRelated($id, array_column($category_arr, 'id'));
}
... ... @@ -395,6 +401,7 @@ class ProjectUpdate extends Command
}
}
}
}
} catch (\Exception $e) {
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
continue;
... ... @@ -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,6 +479,9 @@ 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) {
//按5.0展示才需要更新数据
$model->edit([
'name' => $item['ttile'],
'category_id' => $category_id,
... ... @@ -483,6 +493,7 @@ class ProjectUpdate extends Command
'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;
continue;
... ... @@ -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,6 +548,9 @@ 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'];
$six_read = $custom['six_read'];
if ($six_read) {
//按5.0展示才需要更新数据
$model->edit([
'name' => $item['ttile'],
'title' => $item['ttile'],
... ... @@ -545,6 +559,7 @@ class ProjectUpdate extends Command
'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;
continue;
... ... @@ -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,8 +666,11 @@ 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'];
$six_read = $custom_content['six_read'];
if($six_read){
$model->edit([
'name' => $item['title'],
'category_id' => $category_id,
... ... @@ -661,8 +679,10 @@ class ProjectUpdate extends Command
'image' => $new_img
], ['id' => $id]);
}
}
//扩展字段
if($six_read){
if ($item['extend'] ?? []) {
foreach ($item['extend'] as $ke => $ve) {
$extend = $extend_model->read(['title' => $ke]);
... ... @@ -699,6 +719,7 @@ class ProjectUpdate extends Command
}
}
}
}
} catch (\Exception $e) {
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
continue;
... ...