From 80369a338d11462b0467eb8a253d3e57aacdb9b0 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sat, 10 Jul 2021 19:55:53 +0800 Subject: [PATCH] no message --- app/Http/Controllers/Api/FileController.php | 23 +++++++++++++-------- public/images/file/document.svg | 2 +- public/images/file/excel.svg | 1 + public/images/file/flow.svg | 2 +- public/images/file/folder.svg | 2 +- public/images/file/mind.svg | 2 +- public/images/file/ppt.svg | 1 + public/images/file/sheet.svg | 2 +- public/images/file/word.svg | 1 + 9 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 public/images/file/excel.svg create mode 100644 public/images/file/ppt.svg create mode 100644 public/images/file/word.svg diff --git a/app/Http/Controllers/Api/FileController.php b/app/Http/Controllers/Api/FileController.php index bf33306c..c20f64b8 100755 --- a/app/Http/Controllers/Api/FileController.php +++ b/app/Http/Controllers/Api/FileController.php @@ -362,21 +362,26 @@ class FileController extends AbstractController // if ($status === 2) { $parse = parse_url($url); - $url = 'http://10.22.22.6' . $parse['query'] . '?' . $parse['query']; - $path = public_path('uploads/office/' . $file->id . '/' . $key); - Base::makeDir(dirname($path)); - $res = Ihttp::download($url, $path); + $from = 'http://10.22.22.6' . $parse['path'] . '?' . $parse['query']; + $path = 'uploads/office/' . $file->id . '/' . $user->userid . '-' . $key; + $save = public_path($path); + Base::makeDir(dirname($save)); + $res = Ihttp::download($from, $save); if (Base::isSuccess($res)) { - FileContent::createInstance([ + $content = FileContent::createInstance([ 'fid' => $file->id, 'content' => [ - 'from' => $url, - 'url' => 'uploads/office/' . $file->id . '/' . $key + 'from' => $from, + 'url' => $path ], 'text' => '', - 'size' => filesize($path), + 'size' => filesize($save), 'userid' => $user->userid, - ])->save(); + ]); + $content->save(); + // + $file->size = $content->size; + $file->save(); } } return ['error' => 0]; diff --git a/public/images/file/document.svg b/public/images/file/document.svg index 2dac4e83..e9e55f18 100644 --- a/public/images/file/document.svg +++ b/public/images/file/document.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/public/images/file/excel.svg b/public/images/file/excel.svg new file mode 100644 index 00000000..86688755 --- /dev/null +++ b/public/images/file/excel.svg @@ -0,0 +1 @@ + diff --git a/public/images/file/flow.svg b/public/images/file/flow.svg index f32e101d..1af5497f 100644 --- a/public/images/file/flow.svg +++ b/public/images/file/flow.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/public/images/file/folder.svg b/public/images/file/folder.svg index 60788d5b..47b32776 100644 --- a/public/images/file/folder.svg +++ b/public/images/file/folder.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/public/images/file/mind.svg b/public/images/file/mind.svg index a6636648..af2e370e 100644 --- a/public/images/file/mind.svg +++ b/public/images/file/mind.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/public/images/file/ppt.svg b/public/images/file/ppt.svg new file mode 100644 index 00000000..3d37b593 --- /dev/null +++ b/public/images/file/ppt.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/file/sheet.svg b/public/images/file/sheet.svg index 77ced9bd..d7e11669 100644 --- a/public/images/file/sheet.svg +++ b/public/images/file/sheet.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/public/images/file/word.svg b/public/images/file/word.svg new file mode 100644 index 00000000..d388d694 --- /dev/null +++ b/public/images/file/word.svg @@ -0,0 +1 @@ + \ No newline at end of file