作者 lyh
... ... @@ -308,6 +308,13 @@ class ProjectUpdate extends Command
$keyword_id = ',' . implode(',', array_column($keyword_arr, 'id')) . ',';
}
}
//产品参数
$attrs = [];
if ($item['attr'] ?? []) {
foreach ($item['attr'] as $k_attr => $attr) {
$attrs[] = ['key' => $k_attr, 'value' => $attr];
}
}
//名称去掉特殊符号
$item['ttile'] = $this->special2str($item['ttile'] ?? '');
... ... @@ -323,6 +330,7 @@ class ProjectUpdate extends Command
'keyword_id' => $keyword_id,
'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '',
'gallery' => Arr::a2s($gallery),
'attrs' => Arr::a2s($attrs),
'seo_mate' => Arr::a2s([
'title' => $item['ttile'],
'keyword' => $item['keywords'] ?? '',
... ... @@ -361,7 +369,7 @@ class ProjectUpdate extends Command
'send_time' => $item['post_date'] ?? date('Y-m-d H:i:s'),
'sort' => $item['sort'] ?? 0,
], ['id' => $id]);
}else{
} else {
//按6.0展示只更新分类
$model->edit([
'category_id' => $category_id
... ... @@ -656,15 +664,15 @@ class ProjectUpdate extends Command
$item['title'] = $this->special2str($item['title'] ?? '');
//排序
$sort = 0;
if(isset($item['listorder'])){
if (isset($item['listorder'])) {
$sort = $item['listorder'];
}
if(isset($item['sort'])){
if (isset($item['sort'])) {
$sort = $item['sort'];
}
try {
$custom_content = $model->read(['route' => $route], ['id','six_read']);
$custom_content = $model->read(['route' => $route], ['id', 'six_read']);
if (!$custom_content) {
$id = $model->insertGetId([
'project_id' => $project_id,
... ... @@ -688,7 +696,7 @@ class ProjectUpdate extends Command
} else {
$id = $custom_content['id'];
$six_read = $custom_content['six_read'];
if($six_read){
if ($six_read) {
$model->edit([
'name' => $item['title'],
'category_id' => $category_id,
... ... @@ -701,7 +709,7 @@ class ProjectUpdate extends Command
}
//扩展字段
if($six_read){
if ($six_read) {
if ($item['extend'] ?? []) {
foreach ($item['extend'] as $ke => $ve) {
$extend = $extend_model->read(['title' => $ke]);
... ...