From 6d115df5c1f1b950d1858b3145c5b1332eeab24a Mon Sep 17 00:00:00 2001 From: panliang <1163816051@qq.com> Date: Wed, 17 Aug 2022 12:30:39 +0800 Subject: [PATCH] oss --- app/Console/Commands/OssCopy.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/Console/Commands/OssCopy.php b/app/Console/Commands/OssCopy.php index 3a40c954..205fbe10 100644 --- a/app/Console/Commands/OssCopy.php +++ b/app/Console/Commands/OssCopy.php @@ -110,7 +110,7 @@ class OssCopy extends Command } } if (count($data) > 0) { - // $model->forceFill($data)->save(); + $model->forceFill($data)->save(); } } @@ -124,15 +124,15 @@ class OssCopy extends Command $newUrl = 'https://jiqu-libs.oss-cn-chengdu.aliyuncs.com/'; $bucket = 'jiqu-libs'; - if (!Str::startsWith($url, $newUrl)) { - throw new OssException('1'); - } - // if (Str::startsWith($url, $baseUrl)) { - // $path = substr($url, strlen($baseUrl)); - // $client->copyObject($oldBucket, $path, $bucket, $path); - - // return $newUrl . $path; + // if (!Str::startsWith($url, $newUrl)) { + // throw new OssException('1'); // } + if (Str::startsWith($url, $baseUrl)) { + $path = substr($url, strlen($baseUrl)); + $client->copyObject($oldBucket, $path, $bucket, $path); + + return $newUrl . $path; + } } return $url; }