|
...
|
...
|
@@ -13,6 +13,8 @@ use App\Models\Com\UpdateOldInfo; |
|
|
|
use App\Models\CustomModule\CustomModule;
|
|
|
|
use App\Models\CustomModule\CustomModuleCategory;
|
|
|
|
use App\Models\CustomModule\CustomModuleContent;
|
|
|
|
use App\Models\CustomModule\CustomModuleExtend;
|
|
|
|
use App\Models\CustomModule\CustomModuleExtentContent;
|
|
|
|
use App\Models\News\News;
|
|
|
|
use App\Models\News\NewsCategory;
|
|
|
|
use App\Models\Product\Category;
|
|
...
|
...
|
@@ -566,6 +568,8 @@ class ProjectUpdate extends Command |
|
|
|
|
|
|
|
$model = new CustomModuleContent();
|
|
|
|
$category_model = new CustomModuleCategory();
|
|
|
|
$extend_model = new CustomModuleExtend();
|
|
|
|
$extend_info_model = new CustomModuleExtentContent();
|
|
|
|
|
|
|
|
foreach ($items as $item) {
|
|
|
|
$route = $this->get_url_route($item['url'] ?? '');
|
|
...
|
...
|
@@ -581,6 +585,13 @@ class ProjectUpdate extends Command |
|
|
|
$category_id = $category_custom['id'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//图片
|
|
|
|
if (is_array($item['images'] ?? '')) {
|
|
|
|
$image = $item['images'][0] ?? '';
|
|
|
|
} else {
|
|
|
|
$image = $item['images'] ?? '';
|
|
|
|
}
|
|
|
|
$new_img = $this->source_download($image, $project_id, $domain_arr['host'], $web_url_domain, $home_url);
|
|
|
|
//名称去掉特殊符号
|
|
|
|
$item['title'] = $this->special2str($item['title'] ?? '');
|
|
|
|
|
|
...
|
...
|
@@ -593,6 +604,7 @@ class ProjectUpdate extends Command |
|
|
|
'module_id' => $custom_info['id'],
|
|
|
|
'category_id' => $category_id,
|
|
|
|
'content' => $item['content'] ?? '',
|
|
|
|
'image' => $new_img,
|
|
|
|
'created_at' => $item['post_time'] ?? date('Y-m-d H:i:s'),
|
|
|
|
'updated_at' => $item['post_time'] ?? date('Y-m-d H:i:s'),
|
|
|
|
'is_upgrade' => 1,
|
|
...
|
...
|
@@ -608,8 +620,44 @@ class ProjectUpdate extends Command |
|
|
|
'name' => $item['title'],
|
|
|
|
'category_id' => $category_id,
|
|
|
|
'content' => $item['content'] ?? '',
|
|
|
|
'image' => $new_img
|
|
|
|
], ['id' => $id]);
|
|
|
|
}
|
|
|
|
|
|
|
|
//扩展字段
|
|
|
|
if ($item['extend'][0] ?? []) {
|
|
|
|
foreach ($item['extend'][0] as $ke => $ve) {
|
|
|
|
$extend = $extend_model->read(['title' => $ke]);
|
|
|
|
if ($extend) {
|
|
|
|
$extend_info = $extend_info_model->read(['key' => $extend['key'], 'content_id' => $id]);
|
|
|
|
if (!$extend_info) {
|
|
|
|
if ($extend['type'] == 3) {
|
|
|
|
$gallery = [];
|
|
|
|
if (is_array($ve)) {
|
|
|
|
foreach ($ve as $ve_img) {
|
|
|
|
$gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve_img, $project_id, $domain_arr['host'], $web_url_domain, $home_url)];
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url)];
|
|
|
|
}
|
|
|
|
$value = Arr::a2s($gallery);
|
|
|
|
} elseif ($extend['type'] == 4) {
|
|
|
|
$value = Arr::a2s([$this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url)]);
|
|
|
|
} else {
|
|
|
|
$value = $ve;
|
|
|
|
}
|
|
|
|
$extend_info_model->add([
|
|
|
|
'key' => $extend['key'],
|
|
|
|
'type' => $extend['type'],
|
|
|
|
'project_id' => $project_id,
|
|
|
|
'content_id' => $id,
|
|
|
|
'module_id' => $custom_info['id'],
|
|
|
|
'values' => $value,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
|
|
|
|
continue;
|
...
|
...
|
|