base
parent
a3107bba64
commit
ff7a9dde91
|
|
@ -9,9 +9,9 @@ use App\Models\DrawPrize;
|
|||
use App\Models\ProductBuynote;
|
||||
use App\Models\ProductCategory;
|
||||
use App\Models\ProductFeature;
|
||||
use App\Models\ProductSku;
|
||||
use App\Models\ProductSpu;
|
||||
use App\Models\ShareBg;
|
||||
use App\Models\Store\ProductSku;
|
||||
use App\Models\Store\Store;
|
||||
use App\Models\UserInfo;
|
||||
use Illuminate\Console\Command;
|
||||
|
|
@ -51,18 +51,18 @@ class OssCopy extends Command
|
|||
public function handle()
|
||||
{
|
||||
$list = [
|
||||
['name' => '用户', 'list' => UserInfo::get(), 'attributes' => ['avatar']],
|
||||
['name' => '文章', 'list' => Article::get(), 'attributes' => ['cover', 'content']],
|
||||
['name' => '广告', 'list' => Ad::get(), 'attributes' => ['image']],
|
||||
['name' => '门店', 'list' => Store::get(), 'attributes' => ['image']],
|
||||
['name' => '商品SPU', 'list' => ProductSpu::get(), 'attributes' => ['cover', 'images', 'media', 'description']],
|
||||
// ['name' => '用户', 'list' => UserInfo::get(), 'attributes' => ['avatar']],
|
||||
// ['name' => '文章', 'list' => Article::get(), 'attributes' => ['cover', 'content']],
|
||||
// ['name' => '广告', 'list' => Ad::get(), 'attributes' => ['image']],
|
||||
// ['name' => '门店', 'list' => Store::get(), 'attributes' => ['image']],
|
||||
// ['name' => '商品SPU', 'list' => ProductSpu::get(), 'attributes' => ['cover', 'images', 'media', 'description']],
|
||||
['name' => '商品SKU', 'list' => ProductSku::get(), 'attributes' => ['cover', 'images', 'media', 'description']],
|
||||
['name' => '商品分类', 'list' => ProductCategory::get(), 'attributes' => ['icon']],
|
||||
['name' => '商品特点', 'list' => ProductFeature::get(), 'attributes' => ['icon']],
|
||||
['name' => '购买须知', 'list' => ProductBuynote::get(), 'attributes' => ['content']],
|
||||
['name' => '分享背景', 'list' => ShareBg::get(), 'attributes' => ['image']],
|
||||
['name' => '抽奖活动', 'list' => DrawActivity::get(), 'attributes' => ['desc', 'bg_image']],
|
||||
['name' => '抽奖奖品', 'list' => DrawPrize::get(), 'attributes' => ['icon']],
|
||||
// ['name' => '商品分类', 'list' => ProductCategory::get(), 'attributes' => ['icon']],
|
||||
// ['name' => '商品特点', 'list' => ProductFeature::get(), 'attributes' => ['icon']],
|
||||
// ['name' => '购买须知', 'list' => ProductBuynote::get(), 'attributes' => ['content']],
|
||||
// ['name' => '分享背景', 'list' => ShareBg::get(), 'attributes' => ['image']],
|
||||
// ['name' => '抽奖活动', 'list' => DrawActivity::get(), 'attributes' => ['desc', 'bg_image']],
|
||||
// ['name' => '抽奖奖品', 'list' => DrawPrize::get(), 'attributes' => ['icon']],
|
||||
];
|
||||
|
||||
foreach($list as $item) {
|
||||
|
|
@ -110,7 +110,7 @@ class OssCopy extends Command
|
|||
}
|
||||
}
|
||||
if (count($data) > 0) {
|
||||
$model->forceFill($data)->save();
|
||||
// $model->forceFill($data)->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -119,12 +119,13 @@ class OssCopy extends Command
|
|||
if ($url) {
|
||||
$config = config('filesystems.disks.aliyun');
|
||||
$client = new OssClient(data_get($config, 'access_id'), data_get($config, 'access_key'), data_get($config, 'endpoint'));
|
||||
$baseUrl = 'https://jiqu-library.oss-cn-chengdu.aliyuncs.com/';
|
||||
$baseUrl = 'https://zcs-test.oss-cn-chengdu.aliyuncs.com/';
|
||||
$oldBucket = 'zcs-test';
|
||||
|
||||
$newUrl = 'https://jiqu-libs.oss-cn-chengdu.aliyuncs.com/';
|
||||
$oldBucket = 'jiqu-library';
|
||||
$bucket = 'jiqu-libs';
|
||||
if (Str::startsWith($url, $baseUrl)) {
|
||||
$path = substr($url, strlen($baseUrl));
|
||||
$bucket = 'jiqu-libs';
|
||||
$client->copyObject($oldBucket, $path, $bucket, $path);
|
||||
|
||||
return $newUrl . $path;
|
||||
|
|
|
|||
Loading…
Reference in New Issue