作者 李美松

优化程序

@@ -28,8 +28,6 @@ class ProjectFilePDF extends Command @@ -28,8 +28,6 @@ class ProjectFilePDF extends Command
28 */ 28 */
29 protected $description = '网站项目数据,生成PDF文件'; 29 protected $description = '网站项目数据,生成PDF文件';
30 30
31 - protected $AiccWechat;  
32 -  
33 protected $ProjectAssociation; 31 protected $ProjectAssociation;
34 32
35 protected $DataFile; 33 protected $DataFile;
@@ -48,7 +46,6 @@ class ProjectFilePDF extends Command @@ -48,7 +46,6 @@ class ProjectFilePDF extends Command
48 */ 46 */
49 public function __construct() 47 public function __construct()
50 { 48 {
51 - $this->AiccWechat = new ProjectAssociation();  
52 $this->ProjectAssociation = new ProjectAssociation(); 49 $this->ProjectAssociation = new ProjectAssociation();
53 $this->DataFile = new DataFile(); 50 $this->DataFile = new DataFile();
54 $this->time = date("Y-m"); 51 $this->time = date("Y-m");
@@ -89,11 +86,11 @@ class ProjectFilePDF extends Command @@ -89,11 +86,11 @@ class ProjectFilePDF extends Command
89 $this->debug_echo('pdf生成失败!'); 86 $this->debug_echo('pdf生成失败!');
90 return 0; 87 return 0;
91 } 88 }
92 - $file_path = $file_path['data']; 89 + $file_path = json_encode($file_path['data']);
93 $isRes = $this->DataFile->saveData(compact('project_id', 'user_id', 'friend_id', 'file_path') + ['time' => $this->time]); 90 $isRes = $this->DataFile->saveData(compact('project_id', 'user_id', 'friend_id', 'file_path') + ['time' => $this->time]);
94 if (!$isRes) { 91 if (!$isRes) {
95 if ($count == 2) { 92 if ($count == 2) {
96 - $lists->status = 2; 93 + $lists->is_pdf = 2;
97 $lists->save(); 94 $lists->save();
98 $this->debug_echo('项目文件数据保存失败! - 其他原因 - ' . $key); 95 $this->debug_echo('项目文件数据保存失败! - 其他原因 - ' . $key);
99 } else { 96 } else {
@@ -101,7 +98,7 @@ class ProjectFilePDF extends Command @@ -101,7 +98,7 @@ class ProjectFilePDF extends Command
101 $this->debug_echo('项目文件数据保存失败! - ' . $key); 98 $this->debug_echo('项目文件数据保存失败! - ' . $key);
102 } 99 }
103 } 100 }
104 - $lists->status = 1; 101 + $lists->is_pdf = 1;
105 $lists->save(); 102 $lists->save();
106 $this->debug_echo('项目文件数据保存成功!'); 103 $this->debug_echo('项目文件数据保存成功!');
107 return 0; 104 return 0;
@@ -162,6 +159,11 @@ class ProjectFilePDF extends Command @@ -162,6 +159,11 @@ class ProjectFilePDF extends Command
162 // return 0; 159 // return 0;
163 // } 160 // }
164 161
  162 + /**
  163 + * @param $html
  164 + * @param $filename
  165 + * @return array
  166 + */
165 public function savePDF($html, $filename) 167 public function savePDF($html, $filename)
166 { 168 {
167 169
@@ -16,13 +16,13 @@ class DataFile extends Base @@ -16,13 +16,13 @@ class DataFile extends Base
16 if (!$isRes) { 16 if (!$isRes) {
17 $isRes = new self(); 17 $isRes = new self();
18 $isRes->project_id = $project_id; 18 $isRes->project_id = $project_id;
  19 + # AICC用户ID
  20 + $isRes->user_id = $data['user_id'];
  21 + # 第三方朋友ID
  22 + $isRes->friend_id = $data['friend_id'];
  23 + # 生成文件路径
  24 + $isRes->file_path = $data['file_path'];
19 } 25 }
20 - # AICC用户ID  
21 - $isRes->user_id = $data['user_id'];  
22 - # 第三方朋友ID  
23 - $isRes->friend_id = $data['friend_id'];  
24 - # 生成文件路径  
25 - $isRes->file_path = $data['file_path'];  
26 return $isRes->save(); 26 return $isRes->save();
27 } 27 }
28 28