|
@@ -312,7 +312,7 @@ class ProjectUpdate extends Command |
|
@@ -312,7 +312,7 @@ class ProjectUpdate extends Command |
|
312
|
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
|
312
|
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
|
|
313
|
|
313
|
|
|
314
|
try {
|
314
|
try {
|
|
315
|
- $product = $model->read(['route' => $route], 'id');
|
315
|
+ $product = $model->read(['route' => $route], ['id', 'six_read']);
|
|
316
|
if (!$product) {
|
316
|
if (!$product) {
|
|
317
|
$id = $model->insertGetId([
|
317
|
$id = $model->insertGetId([
|
|
318
|
'project_id' => $project_id,
|
318
|
'project_id' => $project_id,
|
|
@@ -338,60 +338,67 @@ class ProjectUpdate extends Command |
|
@@ -338,60 +338,67 @@ class ProjectUpdate extends Command |
|
338
|
]);
|
338
|
]);
|
|
339
|
$this->set_map($route, RouteMap::SOURCE_PRODUCT, $id, $project_id);
|
339
|
$this->set_map($route, RouteMap::SOURCE_PRODUCT, $id, $project_id);
|
|
340
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PRODUCT, $id, $domain_arr['host'], $link_type, $language_list, $page_list);
|
340
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PRODUCT, $id, $domain_arr['host'], $link_type, $language_list, $page_list);
|
|
|
|
341
|
+ $six_read = 1;
|
|
341
|
} else {
|
342
|
} else {
|
|
342
|
$id = $product['id'];
|
343
|
$id = $product['id'];
|
|
343
|
- $model->edit([
|
|
|
|
344
|
- 'title' => $item['ttile'],
|
|
|
|
345
|
- 'intro' => $item['short_description'] ?? '',
|
|
|
|
346
|
- 'content' => $item['content'] ?? '',
|
|
|
|
347
|
- 'category_id' => $category_id,
|
|
|
|
348
|
- 'keyword_id' => $keyword_id,
|
|
|
|
349
|
- 'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '',
|
|
|
|
350
|
- 'gallery' => Arr::a2s($gallery),
|
|
|
|
351
|
- 'seo_mate' => Arr::a2s([
|
344
|
+ $six_read = $product['six_read'];
|
|
|
|
345
|
+ if ($six_read) {
|
|
|
|
346
|
+ //按5.0展示才需要更新数据
|
|
|
|
347
|
+ $model->edit([
|
|
352
|
'title' => $item['ttile'],
|
348
|
'title' => $item['ttile'],
|
|
353
|
- 'keyword' => $item['keywords'] ?? '',
|
|
|
|
354
|
- 'description' => $item['description'] ?? ''
|
|
|
|
355
|
- ]),
|
|
|
|
356
|
- 'sort' => $item['sort'] ?? 0,
|
|
|
|
357
|
- ], ['id' => $id]);
|
349
|
+ 'intro' => $item['short_description'] ?? '',
|
|
|
|
350
|
+ 'content' => $item['content'] ?? '',
|
|
|
|
351
|
+ 'category_id' => $category_id,
|
|
|
|
352
|
+ 'keyword_id' => $keyword_id,
|
|
|
|
353
|
+ 'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '',
|
|
|
|
354
|
+ 'gallery' => Arr::a2s($gallery),
|
|
|
|
355
|
+ 'seo_mate' => Arr::a2s([
|
|
|
|
356
|
+ 'title' => $item['ttile'],
|
|
|
|
357
|
+ 'keyword' => $item['keywords'] ?? '',
|
|
|
|
358
|
+ 'description' => $item['description'] ?? ''
|
|
|
|
359
|
+ ]),
|
|
|
|
360
|
+ 'sort' => $item['sort'] ?? 0,
|
|
|
|
361
|
+ ], ['id' => $id]);
|
|
|
|
362
|
+ }
|
|
358
|
}
|
363
|
}
|
|
359
|
|
364
|
|
|
360
|
- //关联分类
|
|
|
|
361
|
- if ($category_arr) {
|
|
|
|
362
|
- CategoryRelated::saveRelated($id, array_column($category_arr, 'id'));
|
|
|
|
363
|
- }
|
365
|
+ if ($six_read) {
|
|
|
|
366
|
+ //关联分类
|
|
|
|
367
|
+ if ($category_arr) {
|
|
|
|
368
|
+ CategoryRelated::saveRelated($id, array_column($category_arr, 'id'));
|
|
|
|
369
|
+ }
|
|
364
|
|
370
|
|
|
365
|
- //扩展字段
|
|
|
|
366
|
- if ($item['extend'] ?? []) {
|
|
|
|
367
|
- foreach (array_reverse($item['extend']) as $ke => $ve) {
|
|
|
|
368
|
- if ($ve == '--') {
|
|
|
|
369
|
- $ve = '';
|
|
|
|
370
|
- }
|
|
|
|
371
|
- $extend = $extend_model->read(['title' => $ke]);
|
|
|
|
372
|
- if (!$extend) {
|
|
|
|
373
|
- $extend_key = $this->get_extend_key($extend_model);
|
|
|
|
374
|
- $extend_model->add([
|
|
|
|
375
|
- 'project_id' => $project_id,
|
|
|
|
376
|
- 'title' => $ke,
|
|
|
|
377
|
- 'type' => 1,
|
|
|
|
378
|
- 'key' => $extend_key
|
|
|
|
379
|
- ]);
|
|
|
|
380
|
- } else {
|
|
|
|
381
|
- $extend_key = $extend['key'];
|
|
|
|
382
|
- }
|
371
|
+ //扩展字段
|
|
|
|
372
|
+ if ($item['extend'] ?? []) {
|
|
|
|
373
|
+ foreach (array_reverse($item['extend']) as $ke => $ve) {
|
|
|
|
374
|
+ if ($ve == '--') {
|
|
|
|
375
|
+ $ve = '';
|
|
|
|
376
|
+ }
|
|
|
|
377
|
+ $extend = $extend_model->read(['title' => $ke]);
|
|
|
|
378
|
+ if (!$extend) {
|
|
|
|
379
|
+ $extend_key = $this->get_extend_key($extend_model);
|
|
|
|
380
|
+ $extend_model->add([
|
|
|
|
381
|
+ 'project_id' => $project_id,
|
|
|
|
382
|
+ 'title' => $ke,
|
|
|
|
383
|
+ 'type' => 1,
|
|
|
|
384
|
+ 'key' => $extend_key
|
|
|
|
385
|
+ ]);
|
|
|
|
386
|
+ } else {
|
|
|
|
387
|
+ $extend_key = $extend['key'];
|
|
|
|
388
|
+ }
|
|
383
|
|
389
|
|
|
384
|
- $extend_info = $extend_info_model->read(['key' => $extend_key, 'product_id' => $id]);
|
|
|
|
385
|
- if (!$extend_info) {
|
|
|
|
386
|
- $extend_info_model->add([
|
|
|
|
387
|
- 'key' => $extend_key,
|
|
|
|
388
|
- 'project_id' => $project_id,
|
|
|
|
389
|
- 'product_id' => $id,
|
|
|
|
390
|
- 'values' => $ve,
|
|
|
|
391
|
- 'type' => 1
|
|
|
|
392
|
- ]);
|
|
|
|
393
|
- } else {
|
|
|
|
394
|
- $extend_info_model->edit(['values' => $ve], ['key' => $extend_key, 'product_id' => $id]);
|
390
|
+ $extend_info = $extend_info_model->read(['key' => $extend_key, 'product_id' => $id]);
|
|
|
|
391
|
+ if (!$extend_info) {
|
|
|
|
392
|
+ $extend_info_model->add([
|
|
|
|
393
|
+ 'key' => $extend_key,
|
|
|
|
394
|
+ 'project_id' => $project_id,
|
|
|
|
395
|
+ 'product_id' => $id,
|
|
|
|
396
|
+ 'values' => $ve,
|
|
|
|
397
|
+ 'type' => 1
|
|
|
|
398
|
+ ]);
|
|
|
|
399
|
+ } else {
|
|
|
|
400
|
+ $extend_info_model->edit(['values' => $ve], ['key' => $extend_key, 'product_id' => $id]);
|
|
|
|
401
|
+ }
|
|
395
|
}
|
402
|
}
|
|
396
|
}
|
403
|
}
|
|
397
|
}
|
404
|
}
|
|
@@ -448,7 +455,7 @@ class ProjectUpdate extends Command |
|
@@ -448,7 +455,7 @@ class ProjectUpdate extends Command |
|
448
|
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
|
455
|
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
|
|
449
|
|
456
|
|
|
450
|
try {
|
457
|
try {
|
|
451
|
- $news = $model->read(['url' => $route], 'id');
|
458
|
+ $news = $model->read(['url' => $route], ['id', 'six_read']);
|
|
452
|
if (!$news) {
|
459
|
if (!$news) {
|
|
453
|
$id = $model->insertGetId([
|
460
|
$id = $model->insertGetId([
|
|
454
|
'project_id' => $project_id,
|
461
|
'project_id' => $project_id,
|
|
@@ -472,16 +479,20 @@ class ProjectUpdate extends Command |
|
@@ -472,16 +479,20 @@ class ProjectUpdate extends Command |
|
472
|
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);
|
479
|
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);
|
|
473
|
} else {
|
480
|
} else {
|
|
474
|
$id = $news['id'];
|
481
|
$id = $news['id'];
|
|
475
|
- $model->edit([
|
|
|
|
476
|
- 'name' => $item['ttile'],
|
|
|
|
477
|
- 'category_id' => $category_id,
|
|
|
|
478
|
- 'seo_title' => $item['ttile'],
|
|
|
|
479
|
- 'seo_keywords' => $item['keywords'] ?? '',
|
|
|
|
480
|
- 'seo_description' => $item['description'] ?? '',
|
|
|
|
481
|
- 'text' => $item['content'] ?? '',
|
|
|
|
482
|
- 'image' => $new_img,
|
|
|
|
483
|
- 'sort' => $item['sort'] ?? 0,
|
|
|
|
484
|
- ], ['id' => $id]);
|
482
|
+ $six_read = $news['six_read'];
|
|
|
|
483
|
+ if ($six_read) {
|
|
|
|
484
|
+ //按5.0展示才需要更新数据
|
|
|
|
485
|
+ $model->edit([
|
|
|
|
486
|
+ 'name' => $item['ttile'],
|
|
|
|
487
|
+ 'category_id' => $category_id,
|
|
|
|
488
|
+ 'seo_title' => $item['ttile'],
|
|
|
|
489
|
+ 'seo_keywords' => $item['keywords'] ?? '',
|
|
|
|
490
|
+ 'seo_description' => $item['description'] ?? '',
|
|
|
|
491
|
+ 'text' => $item['content'] ?? '',
|
|
|
|
492
|
+ 'image' => $new_img,
|
|
|
|
493
|
+ 'sort' => $item['sort'] ?? 0,
|
|
|
|
494
|
+ ], ['id' => $id]);
|
|
|
|
495
|
+ }
|
|
485
|
}
|
496
|
}
|
|
486
|
} catch (\Exception $e) {
|
497
|
} catch (\Exception $e) {
|
|
487
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
498
|
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 |
|
@@ -516,7 +527,7 @@ class ProjectUpdate extends Command |
|
516
|
//名称去掉特殊符号
|
527
|
//名称去掉特殊符号
|
|
517
|
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
|
528
|
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
|
|
518
|
try {
|
529
|
try {
|
|
519
|
- $custom = $model->read(['url' => $route], 'id');
|
530
|
+ $custom = $model->read(['url' => $route], ['id', 'six_read']);
|
|
520
|
if (!$custom) {
|
531
|
if (!$custom) {
|
|
521
|
$id = $model->insertGetId([
|
532
|
$id = $model->insertGetId([
|
|
522
|
'project_id' => $project_id,
|
533
|
'project_id' => $project_id,
|
|
@@ -537,13 +548,17 @@ class ProjectUpdate extends Command |
|
@@ -537,13 +548,17 @@ class ProjectUpdate extends Command |
|
537
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PAGE, $id, $domain_arr['host'], $link_type, $language_list, $page_list);
|
548
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PAGE, $id, $domain_arr['host'], $link_type, $language_list, $page_list);
|
|
538
|
} else {
|
549
|
} else {
|
|
539
|
$id = $custom['id'];
|
550
|
$id = $custom['id'];
|
|
540
|
- $model->edit([
|
|
|
|
541
|
- 'name' => $item['ttile'],
|
|
|
|
542
|
- 'title' => $item['ttile'],
|
|
|
|
543
|
- 'keywords' => $item['keywords'] ?? '',
|
|
|
|
544
|
- 'description' => $item['description'] ?? '',
|
|
|
|
545
|
- 'html' => $item['content'] ?? '',
|
|
|
|
546
|
- ], ['id' => $id]);
|
551
|
+ $six_read = $custom['six_read'];
|
|
|
|
552
|
+ if ($six_read) {
|
|
|
|
553
|
+ //按5.0展示才需要更新数据
|
|
|
|
554
|
+ $model->edit([
|
|
|
|
555
|
+ 'name' => $item['ttile'],
|
|
|
|
556
|
+ 'title' => $item['ttile'],
|
|
|
|
557
|
+ 'keywords' => $item['keywords'] ?? '',
|
|
|
|
558
|
+ 'description' => $item['description'] ?? '',
|
|
|
|
559
|
+ 'html' => $item['content'] ?? '',
|
|
|
|
560
|
+ ], ['id' => $id]);
|
|
|
|
561
|
+ }
|
|
547
|
}
|
562
|
}
|
|
548
|
} catch (\Exception $e) {
|
563
|
} catch (\Exception $e) {
|
|
549
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
564
|
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 |
|
@@ -632,7 +647,7 @@ class ProjectUpdate extends Command |
|
632
|
$item['title'] = $this->special2str($item['title'] ?? '');
|
647
|
$item['title'] = $this->special2str($item['title'] ?? '');
|
|
633
|
|
648
|
|
|
634
|
try {
|
649
|
try {
|
|
635
|
- $custom_content = $model->read(['route' => $route], 'id');
|
650
|
+ $custom_content = $model->read(['route' => $route], ['id','six_read']);
|
|
636
|
if (!$custom_content) {
|
651
|
if (!$custom_content) {
|
|
637
|
$id = $model->insertGetId([
|
652
|
$id = $model->insertGetId([
|
|
638
|
'project_id' => $project_id,
|
653
|
'project_id' => $project_id,
|
|
@@ -651,50 +666,56 @@ class ProjectUpdate extends Command |
|
@@ -651,50 +666,56 @@ class ProjectUpdate extends Command |
|
651
|
$this->set_map($route, RouteMap::SOURCE_MODULE, $id, $project_id);
|
666
|
$this->set_map($route, RouteMap::SOURCE_MODULE, $id, $project_id);
|
|
652
|
|
667
|
|
|
653
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_MODULE, $id, $domain_arr['host'], $link_type, $language_list, $page_list);
|
668
|
CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_MODULE, $id, $domain_arr['host'], $link_type, $language_list, $page_list);
|
|
|
|
669
|
+ $six_read = 1;
|
|
654
|
} else {
|
670
|
} else {
|
|
655
|
$id = $custom_content['id'];
|
671
|
$id = $custom_content['id'];
|
|
656
|
- $model->edit([
|
|
|
|
657
|
- 'name' => $item['title'],
|
|
|
|
658
|
- 'category_id' => $category_id,
|
|
|
|
659
|
- 'content' => $item['content'] ?? '',
|
|
|
|
660
|
- 'sort' => $item['sort'] ?? 0,
|
|
|
|
661
|
- 'image' => $new_img
|
|
|
|
662
|
- ], ['id' => $id]);
|
672
|
+ $six_read = $custom_content['six_read'];
|
|
|
|
673
|
+ if($six_read){
|
|
|
|
674
|
+ $model->edit([
|
|
|
|
675
|
+ 'name' => $item['title'],
|
|
|
|
676
|
+ 'category_id' => $category_id,
|
|
|
|
677
|
+ 'content' => $item['content'] ?? '',
|
|
|
|
678
|
+ 'sort' => $item['sort'] ?? 0,
|
|
|
|
679
|
+ 'image' => $new_img
|
|
|
|
680
|
+ ], ['id' => $id]);
|
|
|
|
681
|
+ }
|
|
663
|
}
|
682
|
}
|
|
664
|
|
683
|
|
|
665
|
//扩展字段
|
684
|
//扩展字段
|
|
666
|
- if ($item['extend'] ?? []) {
|
|
|
|
667
|
- foreach ($item['extend'] as $ke => $ve) {
|
|
|
|
668
|
- $extend = $extend_model->read(['title' => $ke]);
|
|
|
|
669
|
- if ($extend) {
|
|
|
|
670
|
- if ($extend['type'] == 3) {
|
|
|
|
671
|
- $gallery = [];
|
|
|
|
672
|
- if (is_array($ve)) {
|
|
|
|
673
|
- foreach ($ve as $ve_img) {
|
|
|
|
674
|
- $gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve_img, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)];
|
685
|
+ if($six_read){
|
|
|
|
686
|
+ if ($item['extend'] ?? []) {
|
|
|
|
687
|
+ foreach ($item['extend'] as $ke => $ve) {
|
|
|
|
688
|
+ $extend = $extend_model->read(['title' => $ke]);
|
|
|
|
689
|
+ if ($extend) {
|
|
|
|
690
|
+ if ($extend['type'] == 3) {
|
|
|
|
691
|
+ $gallery = [];
|
|
|
|
692
|
+ if (is_array($ve)) {
|
|
|
|
693
|
+ foreach ($ve as $ve_img) {
|
|
|
|
694
|
+ $gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve_img, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)];
|
|
|
|
695
|
+ }
|
|
|
|
696
|
+ } else {
|
|
|
|
697
|
+ $gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)];
|
|
675
|
}
|
698
|
}
|
|
|
|
699
|
+ $value = Arr::a2s($gallery);
|
|
|
|
700
|
+ } elseif ($extend['type'] == 4) {
|
|
|
|
701
|
+ $value = Arr::a2s([$this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)]);
|
|
676
|
} else {
|
702
|
} else {
|
|
677
|
- $gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)];
|
703
|
+ $value = $ve;
|
|
678
|
}
|
704
|
}
|
|
679
|
- $value = Arr::a2s($gallery);
|
|
|
|
680
|
- } elseif ($extend['type'] == 4) {
|
|
|
|
681
|
- $value = Arr::a2s([$this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)]);
|
|
|
|
682
|
- } else {
|
|
|
|
683
|
- $value = $ve;
|
|
|
|
684
|
- }
|
|
|
|
685
|
|
705
|
|
|
686
|
- $extend_info = $extend_info_model->read(['key' => $extend['key'], 'content_id' => $id]);
|
|
|
|
687
|
- if (!$extend_info) {
|
|
|
|
688
|
- $extend_info_model->add([
|
|
|
|
689
|
- 'key' => $extend['key'],
|
|
|
|
690
|
- 'type' => $extend['type'],
|
|
|
|
691
|
- 'project_id' => $project_id,
|
|
|
|
692
|
- 'content_id' => $id,
|
|
|
|
693
|
- 'module_id' => $custom_info['id'],
|
|
|
|
694
|
- 'values' => $value,
|
|
|
|
695
|
- ]);
|
|
|
|
696
|
- } else {
|
|
|
|
697
|
- $extend_info_model->edit(['type' => $extend['type'], 'values' => $value], ['key' => $extend['key'], 'content_id' => $id]);
|
706
|
+ $extend_info = $extend_info_model->read(['key' => $extend['key'], 'content_id' => $id]);
|
|
|
|
707
|
+ if (!$extend_info) {
|
|
|
|
708
|
+ $extend_info_model->add([
|
|
|
|
709
|
+ 'key' => $extend['key'],
|
|
|
|
710
|
+ 'type' => $extend['type'],
|
|
|
|
711
|
+ 'project_id' => $project_id,
|
|
|
|
712
|
+ 'content_id' => $id,
|
|
|
|
713
|
+ 'module_id' => $custom_info['id'],
|
|
|
|
714
|
+ 'values' => $value,
|
|
|
|
715
|
+ ]);
|
|
|
|
716
|
+ } else {
|
|
|
|
717
|
+ $extend_info_model->edit(['type' => $extend['type'], 'values' => $value], ['key' => $extend['key'], 'content_id' => $id]);
|
|
|
|
718
|
+ }
|
|
698
|
}
|
719
|
}
|
|
699
|
}
|
720
|
}
|
|
700
|
}
|
721
|
}
|