正在显示
1 个修改的文件
包含
18 行增加
和
3 行删除
| @@ -5,6 +5,7 @@ namespace App\Console\Commands\Update; | @@ -5,6 +5,7 @@ namespace App\Console\Commands\Update; | ||
| 5 | use App\Helper\Arr; | 5 | use App\Helper\Arr; |
| 6 | use App\Http\Logic\Bside\News\NewsLogic; | 6 | use App\Http\Logic\Bside\News\NewsLogic; |
| 7 | use App\Http\Logic\Bside\Product\CategoryLogic; | 7 | use App\Http\Logic\Bside\Product\CategoryLogic; |
| 8 | +use App\Http\Logic\Bside\Product\ExtendLogic; | ||
| 8 | use App\Models\Blog\Blog; | 9 | use App\Models\Blog\Blog; |
| 9 | use App\Models\Collect\CollectSource; | 10 | use App\Models\Collect\CollectSource; |
| 10 | use App\Models\Collect\CollectTask; | 11 | use App\Models\Collect\CollectTask; |
| @@ -304,6 +305,7 @@ class ProjectUpdate extends Command | @@ -304,6 +305,7 @@ class ProjectUpdate extends Command | ||
| 304 | $extend_model = new Extend(); | 305 | $extend_model = new Extend(); |
| 305 | $extend_info_model = new ExtendInfo(); | 306 | $extend_info_model = new ExtendInfo(); |
| 306 | $logic = new CategoryLogic(); | 307 | $logic = new CategoryLogic(); |
| 308 | + $extend_logic = new ExtendLogic(); | ||
| 307 | 309 | ||
| 308 | foreach ($items as $item) { | 310 | foreach ($items as $item) { |
| 309 | $route = $this->get_url_route($item['url'] ?? ''); | 311 | $route = $this->get_url_route($item['url'] ?? ''); |
| @@ -450,13 +452,26 @@ class ProjectUpdate extends Command | @@ -450,13 +452,26 @@ class ProjectUpdate extends Command | ||
| 450 | //扩展字段 | 452 | //扩展字段 |
| 451 | if ($item['extend'] ?? []) { | 453 | if ($item['extend'] ?? []) { |
| 452 | foreach (array_reverse($item['extend']) as $ke => $ve) { | 454 | foreach (array_reverse($item['extend']) as $ke => $ve) { |
| 453 | - if ($ve == '--') { | 455 | + if ($ve == '--' || $ve == '-') { |
| 454 | $ve = ''; | 456 | $ve = ''; |
| 455 | } | 457 | } |
| 456 | $extend = $extend_model->read(['title' => $ke]); | 458 | $extend = $extend_model->read(['title' => $ke]); |
| 457 | 459 | ||
| 460 | + if (empty($extend) && $project_id == 568) { | ||
| 461 | + //568项目由程序添加扩展字段 | ||
| 462 | + $extend_key = $extend_logic->getKey('pd_extended_field_'); | ||
| 463 | + $extend_model->add([ | ||
| 464 | + 'project_id' => $project_id, | ||
| 465 | + 'title' => $ke, | ||
| 466 | + 'type' => Extend::$textExtendType, | ||
| 467 | + 'key' => $extend_key | ||
| 468 | + ]); | ||
| 469 | + | ||
| 470 | + $extend = $extend_model->read(['title' => $ke]); | ||
| 471 | + } | ||
| 472 | + | ||
| 458 | if ($extend) { | 473 | if ($extend) { |
| 459 | - if ($extend['type'] == 3) { | 474 | + if ($extend['type'] == Extend::$imageExtendType) { |
| 460 | //图片 | 475 | //图片 |
| 461 | $gallery = []; | 476 | $gallery = []; |
| 462 | if (is_array($ve)) { | 477 | if (is_array($ve)) { |
| @@ -467,7 +482,7 @@ class ProjectUpdate extends Command | @@ -467,7 +482,7 @@ class ProjectUpdate extends Command | ||
| 467 | $gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)]; | 482 | $gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)]; |
| 468 | } | 483 | } |
| 469 | $value = Arr::a2s($gallery); | 484 | $value = Arr::a2s($gallery); |
| 470 | - } elseif ($extend['type'] == 4) { | 485 | + } elseif ($extend['type'] == Extend::$fileExtendType) { |
| 471 | //文件 | 486 | //文件 |
| 472 | $file = []; | 487 | $file = []; |
| 473 | if (is_array($ve)) { | 488 | if (is_array($ve)) { |
-
请 注册 或 登录 后发表评论