|
@@ -35,7 +35,7 @@ class ProjectFilePDF extends Command |
|
@@ -35,7 +35,7 @@ class ProjectFilePDF extends Command |
|
35
|
protected $time;
|
35
|
protected $time;
|
|
36
|
|
36
|
|
|
37
|
// 最大支持5个进程
|
37
|
// 最大支持5个进程
|
|
38
|
- public int $maxRunNumber = 50;
|
38
|
+ public int $maxRunNumber = 50;
|
|
39
|
|
39
|
|
|
40
|
public FileController $fileController;
|
40
|
public FileController $fileController;
|
|
41
|
|
41
|
|
|
@@ -54,10 +54,49 @@ class ProjectFilePDF extends Command |
|
@@ -54,10 +54,49 @@ class ProjectFilePDF extends Command |
|
54
|
}
|
54
|
}
|
|
55
|
|
55
|
|
|
56
|
|
56
|
|
|
57
|
- public function handle()
|
|
|
|
58
|
- {
|
|
|
|
59
|
-
|
|
|
|
60
|
- }
|
57
|
+// public function handle()
|
|
|
|
58
|
+// {
|
|
|
|
59
|
+// $status = 0; # 0 - 未生成 1 - 已生成 2 - 其它问题
|
|
|
|
60
|
+// $lists = $this->DataFile::query()->where('status', $status)
|
|
|
|
61
|
+// ->where('project_id', '!=', 0)
|
|
|
|
62
|
+// ->where('friend_id', '!=', 0)
|
|
|
|
63
|
+// ->where('user_id', '!=', 0)
|
|
|
|
64
|
+// ->where('created_at', 'like', $this->time . '%')->first();
|
|
|
|
65
|
+// if (is_null($lists)) {
|
|
|
|
66
|
+// $this->error('没有任务,等待中');
|
|
|
|
67
|
+// sleep(60);
|
|
|
|
68
|
+// return 0;
|
|
|
|
69
|
+// }
|
|
|
|
70
|
+// $key = $this->signature . '-' . $lists->id;
|
|
|
|
71
|
+// $count = redis_get($key);
|
|
|
|
72
|
+// $project_id = $lists->project_id;
|
|
|
|
73
|
+// $user_id = $lists->user_id;
|
|
|
|
74
|
+// $friend_id = $lists->friend_id;
|
|
|
|
75
|
+// // todo 根据项目查询数据
|
|
|
|
76
|
+// $project_data = [];
|
|
|
|
77
|
+// $html = $this->html($project_data);
|
|
|
|
78
|
+// $filename = hash('md5', $this->time . '-' . $project_id . '-' . $friend_id . '-' . $user_id);
|
|
|
|
79
|
+// $file_path = $this->savePDF($html, $filename);
|
|
|
|
80
|
+// if (empty($file_path)) {
|
|
|
|
81
|
+// $this->error('pdf生成失败!');
|
|
|
|
82
|
+// return 0;
|
|
|
|
83
|
+// }
|
|
|
|
84
|
+// $isRes = $this->DataFile->saveData(compact('project_id', 'user_id', 'friend_id', 'file_path') + ['time' => $this->time]);
|
|
|
|
85
|
+// if (!$isRes) {
|
|
|
|
86
|
+// if ($count == 2) {
|
|
|
|
87
|
+// $lists->is_pdf = 2;
|
|
|
|
88
|
+// $lists->save();
|
|
|
|
89
|
+// $this->error('项目文件数据保存失败! - 其他原因 - ' . $key);
|
|
|
|
90
|
+// } else {
|
|
|
|
91
|
+// redis_add($key, $count + 1);
|
|
|
|
92
|
+// $this->error('项目文件数据保存失败! - ' . $key);
|
|
|
|
93
|
+// }
|
|
|
|
94
|
+// }
|
|
|
|
95
|
+// $lists->is_pdf = 1;
|
|
|
|
96
|
+// $lists->save();
|
|
|
|
97
|
+// $this->error('项目文件数据保存成功!');
|
|
|
|
98
|
+// return 0;
|
|
|
|
99
|
+// }
|
|
61
|
|
100
|
|
|
62
|
public function start(): int
|
101
|
public function start(): int
|
|
63
|
{
|
102
|
{
|
|
@@ -138,8 +177,10 @@ class ProjectFilePDF extends Command |
|
@@ -138,8 +177,10 @@ class ProjectFilePDF extends Command |
|
138
|
|
177
|
|
|
139
|
// 创建一个文件实例
|
178
|
// 创建一个文件实例
|
|
140
|
$file = new File($savePath);
|
179
|
$file = new File($savePath);
|
|
|
|
180
|
+// var_dump($file->getExtension());
|
|
|
|
181
|
+// exit();
|
|
141
|
|
182
|
|
|
142
|
- return $this->fileController->single($file);
|
183
|
+ echo $this->fileController->single($file);
|
|
143
|
}
|
184
|
}
|
|
144
|
|
185
|
|
|
145
|
/**
|
186
|
/**
|