作者 李美松

逻辑 - 数据更新

@@ -39,7 +39,7 @@ class ProjectFilePDF extends Command @@ -39,7 +39,7 @@ class ProjectFilePDF extends Command
39 { 39 {
40 $this->AiccWechat = new ProjectAssociation(); 40 $this->AiccWechat = new ProjectAssociation();
41 $this->DataFile = new DataFile(); 41 $this->DataFile = new DataFile();
42 - $this->time = date("Y-m-d"); 42 + $this->time = date("Y-m");
43 parent::__construct(); 43 parent::__construct();
44 } 44 }
45 45
@@ -121,9 +121,12 @@ class ProjectFilePDF extends Command @@ -121,9 +121,12 @@ class ProjectFilePDF extends Command
121 121
122 // 获取PDF内容 122 // 获取PDF内容
123 $pdfContent = $dompdf->output(); 123 $pdfContent = $dompdf->output();
124 - 124 + $pdf_path = public_path('PDF/');
  125 + if (!file_exists($pdf_path)) {
  126 + mkdir($pdf_path, 0777, true);
  127 + }
125 // 指定保存路径和文件名 128 // 指定保存路径和文件名
126 - $savePath = public_path('PDF/' . $filename . '.pdf'); 129 + $savePath = $pdf_path . $filename . '.pdf';
127 130
128 // 将PDF内容保存到文件 131 // 将PDF内容保存到文件
129 file_put_contents($savePath, $pdfContent); 132 file_put_contents($savePath, $pdfContent);
@@ -28,11 +28,11 @@ class ProjectAssociation extends Model @@ -28,11 +28,11 @@ class ProjectAssociation extends Model
28 # AICC朋友昵称 28 # AICC朋友昵称
29 $isRes->nickname = $data['nickname'] ?? 0; 29 $isRes->nickname = $data['nickname'] ?? 0;
30 # AICC用户ID 30 # AICC用户ID
31 - $isRes->user_id = $data['user_id'] ?? 0; 31 + $isRes->user_id = $data['user_id'] ?? 0;
32 # AICC用户姓名 32 # AICC用户姓名
33 $isRes->user_name = $data['user_name'] ?? ''; 33 $isRes->user_name = $data['user_name'] ?? '';
34 # AICC朋友头像 34 # AICC朋友头像
35 - $isRes->image = $data['image'] ?? ''; 35 + $isRes->image = $data['image'] ?? '';
36 return $isRes->save(); 36 return $isRes->save();
37 } 37 }
38 38
@@ -55,9 +55,9 @@ class ProjectAssociation extends Model @@ -55,9 +55,9 @@ class ProjectAssociation extends Model
55 { 55 {
56 $status = 1; # 1 - 正常, 0 - 禁用 56 $status = 1; # 1 - 正常, 0 - 禁用
57 $lists = self::query()->where('status', $status) 57 $lists = self::query()->where('status', $status)
58 - ->whereNotNull('project_id')  
59 - ->whereNotNull('friend_id')  
60 - ->whereNotNull('user_id') 58 + ->where('project_id', '!=', 0)
  59 + ->where('friend_id', '!=', 0)
  60 + ->where('user_id', '!=', 0)
61 ->paginate($perPage, ['project_id', 'friend_id', 'user_id'], 'page', $page); 61 ->paginate($perPage, ['project_id', 'friend_id', 'user_id'], 'page', $page);
62 $items = $lists->Items(); 62 $items = $lists->Items();
63 $totalPage = $lists->lastPage(); 63 $totalPage = $lists->lastPage();