|
...
|
...
|
@@ -35,7 +35,7 @@ class ProjectFilePDF extends Command |
|
|
|
protected $time;
|
|
|
|
|
|
|
|
// 最大支持5个进程
|
|
|
|
public int $maxRunNumber = 50;
|
|
|
|
public int $maxRunNumber = 50;
|
|
|
|
|
|
|
|
public FileController $fileController;
|
|
|
|
|
|
...
|
...
|
@@ -54,10 +54,49 @@ class ProjectFilePDF extends Command |
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
// public function handle()
|
|
|
|
// {
|
|
|
|
// $status = 0; # 0 - 未生成 1 - 已生成 2 - 其它问题
|
|
|
|
// $lists = $this->DataFile::query()->where('status', $status)
|
|
|
|
// ->where('project_id', '!=', 0)
|
|
|
|
// ->where('friend_id', '!=', 0)
|
|
|
|
// ->where('user_id', '!=', 0)
|
|
|
|
// ->where('created_at', 'like', $this->time . '%')->first();
|
|
|
|
// if (is_null($lists)) {
|
|
|
|
// $this->error('没有任务,等待中');
|
|
|
|
// sleep(60);
|
|
|
|
// return 0;
|
|
|
|
// }
|
|
|
|
// $key = $this->signature . '-' . $lists->id;
|
|
|
|
// $count = redis_get($key);
|
|
|
|
// $project_id = $lists->project_id;
|
|
|
|
// $user_id = $lists->user_id;
|
|
|
|
// $friend_id = $lists->friend_id;
|
|
|
|
// // todo 根据项目查询数据
|
|
|
|
// $project_data = [];
|
|
|
|
// $html = $this->html($project_data);
|
|
|
|
// $filename = hash('md5', $this->time . '-' . $project_id . '-' . $friend_id . '-' . $user_id);
|
|
|
|
// $file_path = $this->savePDF($html, $filename);
|
|
|
|
// if (empty($file_path)) {
|
|
|
|
// $this->error('pdf生成失败!');
|
|
|
|
// return 0;
|
|
|
|
// }
|
|
|
|
// $isRes = $this->DataFile->saveData(compact('project_id', 'user_id', 'friend_id', 'file_path') + ['time' => $this->time]);
|
|
|
|
// if (!$isRes) {
|
|
|
|
// if ($count == 2) {
|
|
|
|
// $lists->is_pdf = 2;
|
|
|
|
// $lists->save();
|
|
|
|
// $this->error('项目文件数据保存失败! - 其他原因 - ' . $key);
|
|
|
|
// } else {
|
|
|
|
// redis_add($key, $count + 1);
|
|
|
|
// $this->error('项目文件数据保存失败! - ' . $key);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// $lists->is_pdf = 1;
|
|
|
|
// $lists->save();
|
|
|
|
// $this->error('项目文件数据保存成功!');
|
|
|
|
// return 0;
|
|
|
|
// }
|
|
|
|
|
|
|
|
public function start(): int
|
|
|
|
{
|
|
...
|
...
|
@@ -138,8 +177,10 @@ class ProjectFilePDF extends Command |
|
|
|
|
|
|
|
// 创建一个文件实例
|
|
|
|
$file = new File($savePath);
|
|
|
|
// var_dump($file->getExtension());
|
|
|
|
// exit();
|
|
|
|
|
|
|
|
return $this->fileController->single($file);
|
|
|
|
echo $this->fileController->single($file);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|