|
@@ -11,7 +11,10 @@ namespace App\Console\Commands\Project; |
|
@@ -11,7 +11,10 @@ namespace App\Console\Commands\Project; |
|
11
|
|
11
|
|
|
12
|
use App\Models\Domain\DomainInfo;
|
12
|
use App\Models\Domain\DomainInfo;
|
|
13
|
use App\Models\Project\Project;
|
13
|
use App\Models\Project\Project;
|
|
|
|
14
|
+use App\Models\WebSetting\WebSettingSeo;
|
|
|
|
15
|
+use App\Services\ProjectServer;
|
|
14
|
use Illuminate\Console\Command;
|
16
|
use Illuminate\Console\Command;
|
|
|
|
17
|
+use Illuminate\Support\Facades\DB;
|
|
15
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
18
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
16
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
19
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
|
17
|
|
20
|
|
|
@@ -31,15 +34,35 @@ class DownloadProject extends Command |
|
@@ -31,15 +34,35 @@ class DownloadProject extends Command |
|
31
|
*/
|
34
|
*/
|
|
32
|
protected $description = '导出项目数据';
|
35
|
protected $description = '导出项目数据';
|
|
33
|
|
36
|
|
|
|
|
37
|
+// public function handle(){
|
|
|
|
38
|
+// $projectModel = new Project();
|
|
|
|
39
|
+// $data = $projectModel->formatQuery(['channel'=>['like','%"channel_id": "57"%'],'delete_status'=>0])->with(['deploy_optimize'])->get()->toArray();
|
|
|
|
40
|
+// if(!empty($data)){
|
|
|
|
41
|
+// $result = $this->exportData($data);
|
|
|
|
42
|
+// }
|
|
|
|
43
|
+// echo date('Y-m-d H:i:s') . ' ' . json_encode($result) . PHP_EOL;
|
|
|
|
44
|
+// return $result;
|
|
|
|
45
|
+//
|
|
|
|
46
|
+// }
|
|
|
|
47
|
+
|
|
34
|
public function handle(){
|
48
|
public function handle(){
|
|
|
|
49
|
+ $data = [];
|
|
35
|
$projectModel = new Project();
|
50
|
$projectModel = new Project();
|
|
36
|
- $data = $projectModel->formatQuery(['channel'=>['like','%"channel_id": "57"%'],'delete_status'=>0])->with(['deploy_optimize'])->get()->toArray();
|
|
|
|
37
|
- if(!empty($data)){
|
|
|
|
38
|
- $result = $this->exportData($data);
|
51
|
+ $projectList = $projectModel->list(['delete_status'=>0,'type'=>['in',[2,3]]],'id',['id','status','type','title','remain_day']);
|
|
|
|
52
|
+ foreach ($projectList as $v){
|
|
|
|
53
|
+ ProjectServer::useProject($v['id']);
|
|
|
|
54
|
+ $seoModel = new WebSettingSeo();
|
|
|
|
55
|
+ $seoInfo = $seoModel->read(['project_id'=>$v['id']]);
|
|
|
|
56
|
+ if($seoInfo === false){
|
|
|
|
57
|
+ $data[] = $v;
|
|
|
|
58
|
+ }else{
|
|
|
|
59
|
+ if(empty($seoInfo['single_page_suffix'])){
|
|
|
|
60
|
+ $data[] = $v;
|
|
|
|
61
|
+ }
|
|
|
|
62
|
+ }
|
|
|
|
63
|
+ DB::disconnect('custom_mysql');
|
|
39
|
}
|
64
|
}
|
|
40
|
- echo date('Y-m-d H:i:s') . ' ' . json_encode($result) . PHP_EOL;
|
|
|
|
41
|
- return $result;
|
|
|
|
42
|
-
|
65
|
+ return $this->exportData($data);
|
|
43
|
}
|
66
|
}
|
|
44
|
|
67
|
|
|
45
|
public function exportData($data){
|
68
|
public function exportData($data){
|
|
@@ -79,6 +102,7 @@ class DownloadProject extends Command |
|
@@ -79,6 +102,7 @@ class DownloadProject extends Command |
|
79
|
$filePath = public_path('upload/excel/'.$filename);
|
102
|
$filePath = public_path('upload/excel/'.$filename);
|
|
80
|
// 导出 Excel 文件
|
103
|
// 导出 Excel 文件
|
|
81
|
$writer->save($filePath);
|
104
|
$writer->save($filePath);
|
|
|
|
105
|
+ echo date('Y-m-d H:i:s') . 'file_link:'.url('upload/excel/'.$filename) . PHP_EOL;
|
|
82
|
// 返回导出文件的响应
|
106
|
// 返回导出文件的响应
|
|
83
|
return ['file_link'=>url('upload/excel/'.$filename)];
|
107
|
return ['file_link'=>url('upload/excel/'.$filename)];
|
|
84
|
}
|
108
|
}
|