作者 lyh
@@ -308,6 +308,13 @@ class ProjectUpdate extends Command @@ -308,6 +308,13 @@ class ProjectUpdate extends Command
308 $keyword_id = ',' . implode(',', array_column($keyword_arr, 'id')) . ','; 308 $keyword_id = ',' . implode(',', array_column($keyword_arr, 'id')) . ',';
309 } 309 }
310 } 310 }
  311 + //产品参数
  312 + $attrs = [];
  313 + if ($item['attr'] ?? []) {
  314 + foreach ($item['attr'] as $k_attr => $attr) {
  315 + $attrs[] = ['key' => $k_attr, 'value' => $attr];
  316 + }
  317 + }
311 //名称去掉特殊符号 318 //名称去掉特殊符号
312 $item['ttile'] = $this->special2str($item['ttile'] ?? ''); 319 $item['ttile'] = $this->special2str($item['ttile'] ?? '');
313 320
@@ -323,6 +330,7 @@ class ProjectUpdate extends Command @@ -323,6 +330,7 @@ class ProjectUpdate extends Command
323 'keyword_id' => $keyword_id, 330 'keyword_id' => $keyword_id,
324 'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '', 331 'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '',
325 'gallery' => Arr::a2s($gallery), 332 'gallery' => Arr::a2s($gallery),
  333 + 'attrs' => Arr::a2s($attrs),
326 'seo_mate' => Arr::a2s([ 334 'seo_mate' => Arr::a2s([
327 'title' => $item['ttile'], 335 'title' => $item['ttile'],
328 'keyword' => $item['keywords'] ?? '', 336 'keyword' => $item['keywords'] ?? '',
@@ -361,7 +369,7 @@ class ProjectUpdate extends Command @@ -361,7 +369,7 @@ class ProjectUpdate extends Command
361 'send_time' => $item['post_date'] ?? date('Y-m-d H:i:s'), 369 'send_time' => $item['post_date'] ?? date('Y-m-d H:i:s'),
362 'sort' => $item['sort'] ?? 0, 370 'sort' => $item['sort'] ?? 0,
363 ], ['id' => $id]); 371 ], ['id' => $id]);
364 - }else{ 372 + } else {
365 //按6.0展示只更新分类 373 //按6.0展示只更新分类
366 $model->edit([ 374 $model->edit([
367 'category_id' => $category_id 375 'category_id' => $category_id
@@ -656,15 +664,15 @@ class ProjectUpdate extends Command @@ -656,15 +664,15 @@ class ProjectUpdate extends Command
656 $item['title'] = $this->special2str($item['title'] ?? ''); 664 $item['title'] = $this->special2str($item['title'] ?? '');
657 //排序 665 //排序
658 $sort = 0; 666 $sort = 0;
659 - if(isset($item['listorder'])){ 667 + if (isset($item['listorder'])) {
660 $sort = $item['listorder']; 668 $sort = $item['listorder'];
661 } 669 }
662 - if(isset($item['sort'])){ 670 + if (isset($item['sort'])) {
663 $sort = $item['sort']; 671 $sort = $item['sort'];
664 } 672 }
665 673
666 try { 674 try {
667 - $custom_content = $model->read(['route' => $route], ['id','six_read']); 675 + $custom_content = $model->read(['route' => $route], ['id', 'six_read']);
668 if (!$custom_content) { 676 if (!$custom_content) {
669 $id = $model->insertGetId([ 677 $id = $model->insertGetId([
670 'project_id' => $project_id, 678 'project_id' => $project_id,
@@ -688,7 +696,7 @@ class ProjectUpdate extends Command @@ -688,7 +696,7 @@ class ProjectUpdate extends Command
688 } else { 696 } else {
689 $id = $custom_content['id']; 697 $id = $custom_content['id'];
690 $six_read = $custom_content['six_read']; 698 $six_read = $custom_content['six_read'];
691 - if($six_read){ 699 + if ($six_read) {
692 $model->edit([ 700 $model->edit([
693 'name' => $item['title'], 701 'name' => $item['title'],
694 'category_id' => $category_id, 702 'category_id' => $category_id,
@@ -701,7 +709,7 @@ class ProjectUpdate extends Command @@ -701,7 +709,7 @@ class ProjectUpdate extends Command
701 } 709 }
702 710
703 //扩展字段 711 //扩展字段
704 - if($six_read){ 712 + if ($six_read) {
705 if ($item['extend'] ?? []) { 713 if ($item['extend'] ?? []) {
706 foreach ($item['extend'] as $ke => $ve) { 714 foreach ($item['extend'] as $ke => $ve) {
707 $extend = $extend_model->read(['title' => $ke]); 715 $extend = $extend_model->read(['title' => $ke]);