正在显示
1 个修改的文件
包含
37 行增加
和
0 行删除
| @@ -13,6 +13,8 @@ use App\Models\Com\UpdateOldInfo; | @@ -13,6 +13,8 @@ use App\Models\Com\UpdateOldInfo; | ||
| 13 | use App\Models\CustomModule\CustomModule; | 13 | use App\Models\CustomModule\CustomModule; |
| 14 | use App\Models\CustomModule\CustomModuleCategory; | 14 | use App\Models\CustomModule\CustomModuleCategory; |
| 15 | use App\Models\CustomModule\CustomModuleContent; | 15 | use App\Models\CustomModule\CustomModuleContent; |
| 16 | +use App\Models\CustomModule\CustomModuleExtend; | ||
| 17 | +use App\Models\CustomModule\CustomModuleExtentContent; | ||
| 16 | use App\Models\News\News; | 18 | use App\Models\News\News; |
| 17 | use App\Models\News\NewsCategory; | 19 | use App\Models\News\NewsCategory; |
| 18 | use App\Models\Product\Category; | 20 | use App\Models\Product\Category; |
| @@ -566,6 +568,8 @@ class ProjectUpdate extends Command | @@ -566,6 +568,8 @@ class ProjectUpdate extends Command | ||
| 566 | 568 | ||
| 567 | $model = new CustomModuleContent(); | 569 | $model = new CustomModuleContent(); |
| 568 | $category_model = new CustomModuleCategory(); | 570 | $category_model = new CustomModuleCategory(); |
| 571 | + $extend_model = new CustomModuleExtend(); | ||
| 572 | + $extend_info_model = new CustomModuleExtentContent(); | ||
| 569 | 573 | ||
| 570 | foreach ($items as $item) { | 574 | foreach ($items as $item) { |
| 571 | $route = $this->get_url_route($item['url'] ?? ''); | 575 | $route = $this->get_url_route($item['url'] ?? ''); |
| @@ -610,6 +614,39 @@ class ProjectUpdate extends Command | @@ -610,6 +614,39 @@ class ProjectUpdate extends Command | ||
| 610 | 'content' => $item['content'] ?? '', | 614 | 'content' => $item['content'] ?? '', |
| 611 | ], ['id' => $id]); | 615 | ], ['id' => $id]); |
| 612 | } | 616 | } |
| 617 | + | ||
| 618 | + //扩展字段 | ||
| 619 | + if ($item['extend'] ?? []) { | ||
| 620 | + foreach (array_reverse($item['extend']) as $ke => $ve) { | ||
| 621 | + $extend = $extend_model->read(['title' => $ke]); | ||
| 622 | + if (!$extend) { | ||
| 623 | + $extend_key = $this->get_extend_key($extend_model); | ||
| 624 | + $extend_type = 1; | ||
| 625 | + $extend_model->add([ | ||
| 626 | + 'project_id' => $project_id, | ||
| 627 | + 'title' => $ke, | ||
| 628 | + 'type' => $extend_type, | ||
| 629 | + 'key' => $extend_key, | ||
| 630 | + 'module_id' => $custom_info['id'] | ||
| 631 | + ]); | ||
| 632 | + } else { | ||
| 633 | + $extend_key = $extend['key']; | ||
| 634 | + $extend_type = $extend['type']; | ||
| 635 | + } | ||
| 636 | + | ||
| 637 | + $extend_info = $extend_info_model->read(['key' => $extend_key, 'content_id' => $id]); | ||
| 638 | + if (!$extend_info) { | ||
| 639 | + $extend_info_model->add([ | ||
| 640 | + 'key' => $extend_key, | ||
| 641 | + 'type' => $extend_type, | ||
| 642 | + 'project_id' => $project_id, | ||
| 643 | + 'content_id' => $id, | ||
| 644 | + 'module_id' => $custom_info['id'], | ||
| 645 | + 'values' => $ve, | ||
| 646 | + ]); | ||
| 647 | + } | ||
| 648 | + } | ||
| 649 | + } | ||
| 613 | } catch (\Exception $e) { | 650 | } catch (\Exception $e) { |
| 614 | echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; | 651 | echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; |
| 615 | continue; | 652 | continue; |
-
请 注册 或 登录 后发表评论