正在显示
2 个修改的文件
包含
9 行增加
和
6 行删除
| @@ -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); |
| @@ -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(); |
-
请 注册 或 登录 后发表评论