diff --git a/app/admin/controller/v1/Upload.php b/app/admin/controller/v1/Upload.php index a2f729be..de587dd2 100644 --- a/app/admin/controller/v1/Upload.php +++ b/app/admin/controller/v1/Upload.php @@ -72,7 +72,7 @@ class Upload $webp = $image->toWebp(75); $root = config('filesystem.disks.image.root'); $filename = $param['module'] . '/' . ($name_rule() ?? date('Ymd') . '/' . md5((string)time()) . '.webp'); - $webp->save($root . '/' . $filename); + $webp->save($this->checkPath($root . '/' . $filename)); // 获取webp文件大小 $file_size = $webp->size(); // 获取webp文件mime类型 @@ -171,11 +171,36 @@ class Upload 'filesha1' => $image_model->file_sha1 ]); } catch (\Throwable $th) { + dump($th);exit; return error($th->getMessage()); } return error('上传失败'); } + /** + * 检查路径 + * + * @param string $path + * @return string + */ + private function checkPath($path): string + { + $ok = false; + $filename = basename($path); + $dirname = dirname($path); + if (!is_dir($dirname)) { + $ok = @mkdir($dirname, 0755, true); + } + else if (!is_writable($dirname)) { + $ok = @chmod($dirname,0755); + } + + if ($ok) { + return $dirname . '/' . $filename; + } + + throw new \Exception("上传目标目录不可用"); + } /** * 文件名生成回调 * diff --git a/app/index/view/pc/about_us/story.html b/app/index/view/pc/about_us/story.html index 8c509b2b..2213700a 100644 --- a/app/index/view/pc/about_us/story.html +++ b/app/index/view/pc/about_us/story.html @@ -6,7 +6,7 @@
- + {notempty name="banners"}
{volist name="banners" id="ba" offset="0" length="2"} diff --git a/app/index/view/pc/attachment/index.html b/app/index/view/pc/attachment/index.html index ce9cdde5..6421d450 100644 --- a/app/index/view/pc/attachment/index.html +++ b/app/index/view/pc/attachment/index.html @@ -7,7 +7,7 @@
- +
diff --git a/app/index/view/pc/attachment/video.html b/app/index/view/pc/attachment/video.html index 68297f82..c0d256cd 100644 --- a/app/index/view/pc/attachment/video.html +++ b/app/index/view/pc/attachment/video.html @@ -7,7 +7,7 @@
- +
diff --git a/public/static/index/pc/images/OurBrand.png b/public/static/index/pc/images/OurBrand.png deleted file mode 100755 index 6add4876..00000000 Binary files a/public/static/index/pc/images/OurBrand.png and /dev/null differ diff --git a/public/static/index/pc/images/OurBrand.webp b/public/static/index/pc/images/OurBrand.webp new file mode 100644 index 00000000..d3f007e0 Binary files /dev/null and b/public/static/index/pc/images/OurBrand.webp differ diff --git a/public/static/index/pc/images/banner_01.png b/public/static/index/pc/images/banner_01.png deleted file mode 100755 index 46c26fff..00000000 Binary files a/public/static/index/pc/images/banner_01.png and /dev/null differ diff --git a/public/static/index/pc/images/banner_01.webp b/public/static/index/pc/images/banner_01.webp new file mode 100644 index 00000000..03cc195c Binary files /dev/null and b/public/static/index/pc/images/banner_01.webp differ