6
0
Fork 0
panliang 2022-08-17 12:41:44 +08:00
parent 6d115df5c1
commit 7e5fc84f85
1 changed files with 10 additions and 10 deletions

View File

@ -106,11 +106,11 @@ class OssCopy extends Command
} }
} catch (OssException $e) { } catch (OssException $e) {
$item = is_array($item) ? implode(',', $item) : $item; $item = is_array($item) ? implode(',', $item) : $item;
$this->error("model: ".get_class($model).", id: ".$model->id.", key: ".$key.", value: " . $item); $this->info("model: ".get_class($model).", id: ".$model->id.", key: ".$key);
} }
} }
if (count($data) > 0) { 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/'; $newUrl = 'https://jiqu-libs.oss-cn-chengdu.aliyuncs.com/';
$bucket = 'jiqu-libs'; $bucket = 'jiqu-libs';
// if (!Str::startsWith($url, $newUrl)) { if (!Str::startsWith($url, $newUrl)) {
// throw new OssException('1'); 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, $baseUrl)) {
// $path = substr($url, strlen($baseUrl));
// $client->copyObject($oldBucket, $path, $bucket, $path);
// return $newUrl . $path;
// }
} }
return $url; return $url;
} }