|
...
|
...
|
@@ -33,21 +33,24 @@ class ThumbProjectImage extends Command |
|
|
|
//指定项目
|
|
|
|
$this->output('project_id:' . $project_id . ' | start');
|
|
|
|
|
|
|
|
ProjectServer::useProject($project_id);
|
|
|
|
|
|
|
|
Product::select(['id', 'thumb'])->chunk(100, function ($products) {
|
|
|
|
foreach ($products as $product) {
|
|
|
|
$thumb = $product->thumb;
|
|
|
|
if (isset($thumb['url']) && $thumb['url']) {
|
|
|
|
$thumb['url'] = thumbImageByUrl($thumb['url']);
|
|
|
|
$product->timestamps = false;
|
|
|
|
$product->thumb = Arr::a2s($thumb);
|
|
|
|
$product->save();
|
|
|
|
$project_info = ProjectServer::useProject($project_id);
|
|
|
|
|
|
|
|
if ($project_info) {
|
|
|
|
$thumb_w = $project_info->deploy_build->thumb_w ?? 0;
|
|
|
|
Product::select(['id', 'thumb'])->chunk(100, function ($products) use ($thumb_w) {
|
|
|
|
foreach ($products as $product) {
|
|
|
|
$thumb = $product->thumb;
|
|
|
|
if (isset($thumb['url']) && $thumb['url']) {
|
|
|
|
$thumb['url'] = thumbImageByUrl($thumb['url'], $thumb_w);
|
|
|
|
$product->timestamps = false;
|
|
|
|
$product->thumb = Arr::a2s($thumb);
|
|
|
|
$product->save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->output('project_id:' . $project_id . ' | end');
|
|
|
|
} else {
|
|
...
|
...
|
@@ -59,21 +62,24 @@ class ThumbProjectImage extends Command |
|
|
|
|
|
|
|
$this->output('project_id:' . $project_id . ' | start');
|
|
|
|
|
|
|
|
ProjectServer::useProject($project_id);
|
|
|
|
|
|
|
|
Product::select(['id', 'thumb'])->chunk(100, function ($products) {
|
|
|
|
foreach ($products as $product) {
|
|
|
|
$thumb = $product->thumb;
|
|
|
|
if (isset($thumb['url']) && $thumb['url']) {
|
|
|
|
$thumb['url'] = thumbImageByUrl($thumb['url']);
|
|
|
|
$product->timestamps = false;
|
|
|
|
$product->thumb = Arr::a2s($thumb);
|
|
|
|
$product->save();
|
|
|
|
$project_info = ProjectServer::useProject($project_id);
|
|
|
|
|
|
|
|
if ($project_info) {
|
|
|
|
$thumb_w = $project_info->deploy_build->thumb_w ?? 0;
|
|
|
|
Product::select(['id', 'thumb'])->chunk(100, function ($products) use ($thumb_w) {
|
|
|
|
foreach ($products as $product) {
|
|
|
|
$thumb = $product->thumb;
|
|
|
|
if (isset($thumb['url']) && $thumb['url']) {
|
|
|
|
$thumb['url'] = thumbImageByUrl($thumb['url'], $thumb_w);
|
|
|
|
$product->timestamps = false;
|
|
|
|
$product->thumb = Arr::a2s($thumb);
|
|
|
|
$product->save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->output('project_id:' . $project_id . ' | end');
|
|
|
|
}
|
...
|
...
|
|