作者 lyh

gx脚本更新路由

@@ -87,28 +87,27 @@ class UpdateBuildConfiguration extends Command @@ -87,28 +87,27 @@ class UpdateBuildConfiguration extends Command
87 $detailModel = new Detail(); 87 $detailModel = new Detail();
88 if(!empty($lists['list'])){ 88 if(!empty($lists['list'])){
89 foreach ($lists['list'] as $k => $v){ 89 foreach ($lists['list'] as $k => $v){
  90 + echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;
90 if(empty($v['describe'])){ 91 if(empty($v['describe'])){
91 continue; 92 continue;
92 } 93 }
93 - if(empty($v['describe'][0]['text'])){  
94 - continue;  
95 - }  
96 - if(isset($v['describe'][0]['title']) && ($v['describe'][0]['title'] == null)){  
97 - $v['describe'][0]['title'] = '';  
98 - }  
99 - if(isset($v['describe'][0]['text']) && ($v['describe'][0]['text'] == null)){  
100 - $v['describe'][0]['text'] = '';  
101 - }  
102 - echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;  
103 - $info = $detailModel->read(['product_id'=>$v['id']],['id']);  
104 - if($info === false){ 94 + foreach ($v['describe'] as $key => $value){
  95 + if(isset($value['title']) && ($value['title'] == null)){
  96 + $value['title'] = '';
  97 + }
  98 + if(isset($value['text']) && ($value['text'] == null)){
  99 + $value['text'] = '';
  100 + }
  101 + if(empty($value['text'])){
  102 + continue;
  103 + }
105 $data = [ 104 $data = [
106 'product_id'=>$v['id'], 105 'product_id'=>$v['id'],
107 'column_id'=>1, 106 'column_id'=>1,
108 'text_type'=>1, 107 'text_type'=>1,
109 - 'title'=>$v['describe'][0]['title'] ?? '', 108 + 'title'=>$value['title'] ?? '',
110 'sort'=>1, 109 'sort'=>1,
111 - 'content'=>json_encode(['content'=>$v['describe'][0]['text'] ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), 110 + 'content'=>json_encode(['content'=>$value['text'] ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
112 'created_at'=>date('Y-m-d H:i:s'), 111 'created_at'=>date('Y-m-d H:i:s'),
113 'updated_at'=>date('Y-m-d H:i:s') 112 'updated_at'=>date('Y-m-d H:i:s')
114 ]; 113 ];