作者 lyh

gx脚本导出产品

@@ -43,7 +43,6 @@ class DownloadProject extends Command @@ -43,7 +43,6 @@ class DownloadProject extends Command
43 $data = $this->downloadProduct(); 43 $data = $this->downloadProduct();
44 DB::disconnect('custom_mysql'); 44 DB::disconnect('custom_mysql');
45 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 45 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
46 - return true;  
47 // return $this->exportData($data); 46 // return $this->exportData($data);
48 } 47 }
49 48
@@ -62,6 +61,7 @@ class DownloadProject extends Command @@ -62,6 +61,7 @@ class DownloadProject extends Command
62 if($detailInfo === false || ($detailInfo['content']['content'] == null)){ 61 if($detailInfo === false || ($detailInfo['content']['content'] == null)){
63 $v['content'] = ''; 62 $v['content'] = '';
64 }else{ 63 }else{
  64 + echo date('Y-m-d H:i:s') . '数据详情$v:'. json_encode($detailInfo) . PHP_EOL;
65 $v['content'] = $detailInfo['content']['content']; 65 $v['content'] = $detailInfo['content']['content'];
66 } 66 }
67 $v['url'] = 'https://www.autsikinta.com/' . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']); 67 $v['url'] = 'https://www.autsikinta.com/' . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']);
@@ -120,30 +120,21 @@ class DownloadProject extends Command @@ -120,30 +120,21 @@ class DownloadProject extends Command
120 $sheet = $spreadsheet->getActiveSheet(); 120 $sheet = $spreadsheet->getActiveSheet();
121 // 添加表头 121 // 添加表头
122 $sheet->setCellValue('A1', '产品名称'); 122 $sheet->setCellValue('A1', '产品名称');
123 - $sheet->setCellValue('B1', '产品描述'); 123 + $sheet->setCellValue('B1', '产品描述');
124 $sheet->setCellValue('C1', '产品内容'); 124 $sheet->setCellValue('C1', '产品内容');
125 $sheet->setCellValue('D1', '产品路由'); 125 $sheet->setCellValue('D1', '产品路由');
126 $sheet->setCellValue('E1', '产品分类'); 126 $sheet->setCellValue('E1', '产品分类');
127 $sheet->setCellValue('F1', '产品状态'); 127 $sheet->setCellValue('F1', '产品状态');
128 $sheet->setCellValue('G1', '产品主图'); 128 $sheet->setCellValue('G1', '产品主图');
129 $rowCount = 2; 129 $rowCount = 2;
130 -// $allData = $this->countAll();  
131 foreach ($data as $v) { 130 foreach ($data as $v) {
132 - $domain = (new DomainInfo())->getDomain($v['deploy_optimize']['domain'] ?? 0);  
133 - if($v['type'] == 1){  
134 - $status = '建站中';  
135 - }elseif ($v['type'] == 2){  
136 - $status = '优化中';  
137 - }elseif ($v['type'] == 3){  
138 - $status = '建站后';  
139 - }else{  
140 - $status = '';  
141 - }  
142 - $sheet->setCellValue('A' . $rowCount, $v['id']);  
143 - $sheet->setCellValue('B' . $rowCount, $v['title']);  
144 - $sheet->setCellValue('C' . $rowCount, $domain);  
145 - $sheet->setCellValue('D' . $rowCount, $status);  
146 - $sheet->setCellValue('E' . $rowCount, $v['remain_day']); 131 + $sheet->setCellValue('A' . $rowCount, $v['title']);
  132 + $sheet->setCellValue('B' . $rowCount, $v['intro']);
  133 + $sheet->setCellValue('C' . $rowCount, $v['content']);
  134 + $sheet->setCellValue('D' . $rowCount, $v['url']);
  135 + $sheet->setCellValue('E' . $rowCount, $v['category_id_text']);
  136 + $sheet->setCellValue('F' . $rowCount, '发布中');
  137 + $sheet->setCellValue('G' . $rowCount, $v['images']);
147 $rowCount++; 138 $rowCount++;
148 } 139 }
149 // 创建一个新的 Excel Writer 对象 140 // 创建一个新的 Excel Writer 对象