|
@@ -383,20 +383,12 @@ class ProjectUpdate extends Command |
|
@@ -383,20 +383,12 @@ class ProjectUpdate extends Command |
|
383
|
'sort' => $item['sort'] ?? 0,
|
383
|
'sort' => $item['sort'] ?? 0,
|
|
384
|
'files' => $files,
|
384
|
'files' => $files,
|
|
385
|
], ['id' => $id]);
|
385
|
], ['id' => $id]);
|
|
386
|
- } else {
|
|
|
|
387
|
- //按6.0展示只更新分类
|
|
|
|
388
|
- $model->edit([
|
|
|
|
389
|
- 'category_id' => $category_id
|
|
|
|
390
|
- ], ['id' => $id]);
|
|
|
|
391
|
}
|
386
|
}
|
|
392
|
}
|
387
|
}
|
|
393
|
|
388
|
|
|
394
|
- //关联分类
|
|
|
|
395
|
- if ($category_arr) {
|
|
|
|
396
|
- CategoryRelated::saveRelated($id, array_column($category_arr, 'id'));
|
|
|
|
397
|
- }
|
|
|
|
398
|
-
|
|
|
|
399
|
if ($six_read) {
|
389
|
if ($six_read) {
|
|
|
|
390
|
+ //关联分类
|
|
|
|
391
|
+ CategoryRelated::saveRelated($id, array_column($category_arr, 'id'));
|
|
400
|
//扩展字段
|
392
|
//扩展字段
|
|
401
|
if ($item['extend'] ?? []) {
|
393
|
if ($item['extend'] ?? []) {
|
|
402
|
foreach (array_reverse($item['extend']) as $ke => $ve) {
|
394
|
foreach (array_reverse($item['extend']) as $ke => $ve) {
|
|
@@ -508,9 +500,7 @@ class ProjectUpdate extends Command |
|
@@ -508,9 +500,7 @@ class ProjectUpdate extends Command |
|
508
|
|
500
|
|
|
509
|
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);
|
501
|
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);
|
|
510
|
} else {
|
502
|
} else {
|
|
511
|
- $id = $news['id'];
|
|
|
|
512
|
- $six_read = $news['six_read'];
|
|
|
|
513
|
- if ($six_read) {
|
503
|
+ if ($news['six_read']) {
|
|
514
|
//按5.0展示才需要更新数据
|
504
|
//按5.0展示才需要更新数据
|
|
515
|
$model->edit([
|
505
|
$model->edit([
|
|
516
|
'name' => $item['ttile'],
|
506
|
'name' => $item['ttile'],
|
|
@@ -522,7 +512,7 @@ class ProjectUpdate extends Command |
|
@@ -522,7 +512,7 @@ class ProjectUpdate extends Command |
|
522
|
'image' => $new_img,
|
512
|
'image' => $new_img,
|
|
523
|
'release_at' => $item['post_date'] ?? date('Y-m-d H:i:s'),
|
513
|
'release_at' => $item['post_date'] ?? date('Y-m-d H:i:s'),
|
|
524
|
'sort' => $item['sort'] ?? 0,
|
514
|
'sort' => $item['sort'] ?? 0,
|
|
525
|
- ], ['id' => $id]);
|
515
|
+ ], ['id' => $news['id']]);
|
|
526
|
}
|
516
|
}
|
|
527
|
}
|
517
|
}
|
|
528
|
} catch (\Exception $e) {
|
518
|
} catch (\Exception $e) {
|
|
@@ -855,51 +845,61 @@ class ProjectUpdate extends Command |
|
@@ -855,51 +845,61 @@ class ProjectUpdate extends Command |
|
855
|
foreach ($items as $item) {
|
845
|
foreach ($items as $item) {
|
|
856
|
$route = $this->get_url_route($item['url'] ?? '');
|
846
|
$route = $this->get_url_route($item['url'] ?? '');
|
|
857
|
if ($route) {
|
847
|
if ($route) {
|
|
858
|
- $parent = $model->read(['pid' => $pid, 'route' => $route], 'id');
|
|
|
|
859
|
- if (!$parent) {
|
|
|
|
860
|
- try {
|
|
|
|
861
|
- $item['name'] = $this->special2str($item['name'] ?? '');
|
|
|
|
862
|
- //图片
|
|
|
|
863
|
- if (is_array($item['images'] ?? '')) {
|
|
|
|
864
|
- $image = $item['images'][0] ?? '';
|
|
|
|
865
|
- } else {
|
|
|
|
866
|
- $image = $item['images'] ?? '';
|
|
|
|
867
|
- }
|
|
|
|
868
|
- $new_img = $this->source_download($image, $project_id, $domain, $web_url_domain, $home_url);
|
|
|
|
869
|
- //描述
|
|
|
|
870
|
- if (isset($item['description']) && $item['description']) {
|
|
|
|
871
|
- //匹配描述资源
|
|
|
|
872
|
- $source_list = $this->html_preg($item['description'], $project_id, $domain, $web_url_domain, $home_url);
|
|
|
|
873
|
- if ($source_list) {
|
|
|
|
874
|
- foreach ($source_list as $vs) {
|
|
|
|
875
|
- if ($vs['download']) {
|
|
|
|
876
|
- //需要下载资源
|
|
|
|
877
|
- $down_url = $this->source_download($vs['url_complete'], $project_id, $domain, $web_url_domain, $home_url);
|
|
|
|
878
|
- } else {
|
|
|
|
879
|
- //已经下载过资源
|
|
|
|
880
|
- $down_url = getImageUrl($vs['url_complete']);
|
|
|
|
881
|
- }
|
|
|
|
882
|
- $item['description'] = str_replace($vs['url'], $down_url, $item['description']);
|
|
|
|
883
|
- }
|
848
|
+ $item['name'] = $this->special2str($item['name'] ?? '');
|
|
|
|
849
|
+ //图片
|
|
|
|
850
|
+ if (is_array($item['images'] ?? '')) {
|
|
|
|
851
|
+ $image = $item['images'][0] ?? '';
|
|
|
|
852
|
+ } else {
|
|
|
|
853
|
+ $image = $item['images'] ?? '';
|
|
|
|
854
|
+ }
|
|
|
|
855
|
+ $new_img = $this->source_download($image, $project_id, $domain, $web_url_domain, $home_url);
|
|
|
|
856
|
+ //描述
|
|
|
|
857
|
+ $describe = '';
|
|
|
|
858
|
+ if (isset($item['description']) && $item['description']) {
|
|
|
|
859
|
+ $describe = $item['description'];
|
|
|
|
860
|
+ //匹配描述资源
|
|
|
|
861
|
+ $source_list = $this->html_preg($describe, $project_id, $domain, $web_url_domain, $home_url);
|
|
|
|
862
|
+ if ($source_list) {
|
|
|
|
863
|
+ foreach ($source_list as $vs) {
|
|
|
|
864
|
+ if ($vs['download']) {
|
|
|
|
865
|
+ //需要下载资源
|
|
|
|
866
|
+ $down_url = $this->source_download($vs['url_complete'], $project_id, $domain, $web_url_domain, $home_url);
|
|
|
|
867
|
+ } else {
|
|
|
|
868
|
+ //已经下载过资源
|
|
|
|
869
|
+ $down_url = getImageUrl($vs['url_complete']);
|
|
884
|
}
|
870
|
}
|
|
|
|
871
|
+ $describe = str_replace($vs['url'], $down_url, $describe);
|
|
885
|
}
|
872
|
}
|
|
|
|
873
|
+ }
|
|
|
|
874
|
+ }
|
|
|
|
875
|
+ try {
|
|
|
|
876
|
+ $parent = $model->read(['route' => $route], 'id');
|
|
|
|
877
|
+ if (!$parent) {
|
|
886
|
$parent_id = $model->addReturnId([
|
878
|
$parent_id = $model->addReturnId([
|
|
887
|
'project_id' => $project_id,
|
879
|
'project_id' => $project_id,
|
|
888
|
'title' => $item['name'],
|
880
|
'title' => $item['name'],
|
|
889
|
'image' => $new_img,
|
881
|
'image' => $new_img,
|
|
890
|
'pid' => $pid,
|
882
|
'pid' => $pid,
|
|
891
|
'keywords' => $item['keywords'] ?? '',
|
883
|
'keywords' => $item['keywords'] ?? '',
|
|
892
|
- 'describe' => (isset($item['description']) && $item['description']) ? $item['description'] : '',
|
884
|
+ 'describe' => $describe,
|
|
893
|
'original_id' => $item['id'],
|
885
|
'original_id' => $item['id'],
|
|
894
|
'route' => $route
|
886
|
'route' => $route
|
|
895
|
]);
|
887
|
]);
|
|
896
|
$this->set_map($route, RouteMap::SOURCE_PRODUCT_CATE, $parent_id, $project_id);
|
888
|
$this->set_map($route, RouteMap::SOURCE_PRODUCT_CATE, $parent_id, $project_id);
|
|
897
|
- } catch (\Exception $e) {
|
|
|
|
898
|
- echo 'date:' . date('Y-m-d H:i:s') . ', category_insert error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
899
|
- continue;
|
889
|
+ } else {
|
|
|
|
890
|
+ $parent_id = $parent['id'];
|
|
|
|
891
|
+ $model->edit([
|
|
|
|
892
|
+ 'title' => $item['name'],
|
|
|
|
893
|
+ 'image' => $new_img,
|
|
|
|
894
|
+ 'pid' => $pid,
|
|
|
|
895
|
+ 'keywords' => $item['keywords'] ?? '',
|
|
|
|
896
|
+ 'describe' => $describe,
|
|
|
|
897
|
+ 'original_id' => $item['id']
|
|
|
|
898
|
+ ], ['id' => $parent_id]);
|
|
900
|
}
|
899
|
}
|
|
901
|
- } else {
|
|
|
|
902
|
- $parent_id = $parent['id'];
|
900
|
+ } catch (\Exception $e) {
|
|
|
|
901
|
+ echo 'date:' . date('Y-m-d H:i:s') . ', category_insert error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
902
|
+ continue;
|
|
903
|
}
|
903
|
}
|
|
904
|
|
904
|
|
|
905
|
if (!empty($item['children'] ?? [])) {
|
905
|
if (!empty($item['children'] ?? [])) {
|
|
@@ -916,10 +916,10 @@ class ProjectUpdate extends Command |
|
@@ -916,10 +916,10 @@ class ProjectUpdate extends Command |
|
916
|
foreach ($items as $item) {
|
916
|
foreach ($items as $item) {
|
|
917
|
$route = $this->get_url_route($item['url'] ?? '');
|
917
|
$route = $this->get_url_route($item['url'] ?? '');
|
|
918
|
if ($route) {
|
918
|
if ($route) {
|
|
919
|
- $parent = $model->read(['pid' => $pid, 'alias' => $route], 'id');
|
|
|
|
920
|
- if (!$parent) {
|
|
|
|
921
|
- try {
|
|
|
|
922
|
- $item['name'] = $this->special2str($item['name'] ?? '');
|
919
|
+ $item['name'] = $this->special2str($item['name'] ?? '');
|
|
|
|
920
|
+ try {
|
|
|
|
921
|
+ $parent = $model->read(['alias' => $route], 'id');
|
|
|
|
922
|
+ if (!$parent) {
|
|
923
|
$parent_id = $model->addReturnId([
|
923
|
$parent_id = $model->addReturnId([
|
|
924
|
'project_id' => $project_id,
|
924
|
'project_id' => $project_id,
|
|
925
|
'name' => $item['name'],
|
925
|
'name' => $item['name'],
|
|
@@ -928,12 +928,18 @@ class ProjectUpdate extends Command |
|
@@ -928,12 +928,18 @@ class ProjectUpdate extends Command |
|
928
|
'alias' => $route
|
928
|
'alias' => $route
|
|
929
|
]);
|
929
|
]);
|
|
930
|
$this->set_map($route, RouteMap::SOURCE_NEWS_CATE, $parent_id, $project_id);
|
930
|
$this->set_map($route, RouteMap::SOURCE_NEWS_CATE, $parent_id, $project_id);
|
|
931
|
- } catch (\Exception $e) {
|
|
|
|
932
|
- echo 'date:' . date('Y-m-d H:i:s') . ', category_news_insert error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
933
|
- continue;
|
931
|
+
|
|
|
|
932
|
+ } else {
|
|
|
|
933
|
+ $parent_id = $parent['id'];
|
|
|
|
934
|
+ $model->edit([
|
|
|
|
935
|
+ 'name' => $item['name'],
|
|
|
|
936
|
+ 'pid' => $pid,
|
|
|
|
937
|
+ 'original_id' => $item['id'],
|
|
|
|
938
|
+ ], ['id' => $parent_id]);
|
|
934
|
}
|
939
|
}
|
|
935
|
- } else {
|
|
|
|
936
|
- $parent_id = $parent['id'];
|
940
|
+ } catch (\Exception $e) {
|
|
|
|
941
|
+ echo 'date:' . date('Y-m-d H:i:s') . ', category_news_insert error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
942
|
+ continue;
|
|
937
|
}
|
943
|
}
|
|
938
|
|
944
|
|
|
939
|
if (!empty($item['children'] ?? [])) {
|
945
|
if (!empty($item['children'] ?? [])) {
|