作者 李美松

优化程序

... ... @@ -28,8 +28,6 @@ class ProjectFilePDF extends Command
*/
protected $description = '网站项目数据,生成PDF文件';
protected $AiccWechat;
protected $ProjectAssociation;
protected $DataFile;
... ... @@ -48,7 +46,6 @@ class ProjectFilePDF extends Command
*/
public function __construct()
{
$this->AiccWechat = new ProjectAssociation();
$this->ProjectAssociation = new ProjectAssociation();
$this->DataFile = new DataFile();
$this->time = date("Y-m");
... ... @@ -89,11 +86,11 @@ class ProjectFilePDF extends Command
$this->debug_echo('pdf生成失败!');
return 0;
}
$file_path = $file_path['data'];
$file_path = json_encode($file_path['data']);
$isRes = $this->DataFile->saveData(compact('project_id', 'user_id', 'friend_id', 'file_path') + ['time' => $this->time]);
if (!$isRes) {
if ($count == 2) {
$lists->status = 2;
$lists->is_pdf = 2;
$lists->save();
$this->debug_echo('项目文件数据保存失败! - 其他原因 - ' . $key);
} else {
... ... @@ -101,7 +98,7 @@ class ProjectFilePDF extends Command
$this->debug_echo('项目文件数据保存失败! - ' . $key);
}
}
$lists->status = 1;
$lists->is_pdf = 1;
$lists->save();
$this->debug_echo('项目文件数据保存成功!');
return 0;
... ... @@ -162,6 +159,11 @@ class ProjectFilePDF extends Command
// return 0;
// }
/**
* @param $html
* @param $filename
* @return array
*/
public function savePDF($html, $filename)
{
... ...
... ... @@ -16,13 +16,13 @@ class DataFile extends Base
if (!$isRes) {
$isRes = new self();
$isRes->project_id = $project_id;
# AICC用户ID
$isRes->user_id = $data['user_id'];
# 第三方朋友ID
$isRes->friend_id = $data['friend_id'];
# 生成文件路径
$isRes->file_path = $data['file_path'];
}
# AICC用户ID
$isRes->user_id = $data['user_id'];
# 第三方朋友ID
$isRes->friend_id = $data['friend_id'];
# 生成文件路径
$isRes->file_path = $data['file_path'];
return $isRes->save();
}
... ...