作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !363
... ... @@ -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'] ?? '');
... ... @@ -610,6 +614,39 @@ class ProjectUpdate extends Command
'content' => $item['content'] ?? '',
], ['id' => $id]);
}
//扩展字段
if ($item['extend'] ?? []) {
foreach (array_reverse($item['extend']) as $ke => $ve) {
$extend = $extend_model->read(['title' => $ke]);
if (!$extend) {
$extend_key = $this->get_extend_key($extend_model);
$extend_type = 1;
$extend_model->add([
'project_id' => $project_id,
'title' => $ke,
'type' => $extend_type,
'key' => $extend_key,
'module_id' => $custom_info['id']
]);
} else {
$extend_key = $extend['key'];
$extend_type = $extend['type'];
}
$extend_info = $extend_info_model->read(['key' => $extend_key, 'content_id' => $id]);
if (!$extend_info) {
$extend_info_model->add([
'key' => $extend_key,
'type' => $extend_type,
'project_id' => $project_id,
'content_id' => $id,
'module_id' => $custom_info['id'],
'values' => $ve,
]);
}
}
}
} catch (\Exception $e) {
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
continue;
... ...