作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !2729
... ... @@ -37,18 +37,21 @@ class ThumbProjectImage extends Command
if ($project_info) {
$thumb_w = $project_info->deploy_build->thumb_w ?? 0;
Product::select(['id', 'thumb'])->chunk(100, function ($products) use ($thumb_w) {
Product::select(['id', 'project_id', 'thumb'])->chunk(100, function ($products) use ($thumb_w) {
foreach ($products as $product) {
$thumb = $product->thumb;
if (isset($thumb['url']) && $thumb['url']) {
$new_thumb = thumbImageByUrl($thumb['url'], $thumb_w);
if ($new_thumb != $thumb['url']) {
$thumb['url'] = $new_thumb;
$json_thumb = Arr::a2s($thumb);
if (strlen($json_thumb) <= 500) {
$product->timestamps = false;
$product->thumb = Arr::a2s($thumb);
$product->thumb = $json_thumb;
$product->save();
$this->output('product_id:' . $product->id . ' | success');
$this->output('project_id:' . $product->project_id . ',product_id:' . $product->id . ' | success');
}
}
}
}
... ... @@ -61,7 +64,7 @@ class ThumbProjectImage extends Command
} else {
//所有项目
$projectModel = new Project();
$list = $projectModel->list(['delete_status' => 0, 'is_upgrade' => 0, 'type' => ['in', [1, 2, 3, 4, 6]]], 'id', ['id'], 'asc');
$list = $projectModel->list(['id' => ['>', 893], 'delete_status' => 0, 'is_upgrade' => 0, 'type' => ['in', [1, 2, 3, 4, 6]]], 'id', ['id'], 'asc');
foreach ($list as $k => $v) {
$project_id = $v['id'];
... ... @@ -71,18 +74,21 @@ class ThumbProjectImage extends Command
if ($project_info) {
$thumb_w = $project_info->deploy_build->thumb_w ?? 0;
Product::select(['id', 'thumb'])->chunk(100, function ($products) use ($thumb_w) {
Product::select(['id', 'project_id', 'thumb'])->chunk(100, function ($products) use ($thumb_w) {
foreach ($products as $product) {
$thumb = $product->thumb;
if (isset($thumb['url']) && $thumb['url']) {
$new_thumb = thumbImageByUrl($thumb['url'], $thumb_w);
if ($new_thumb != $thumb['url']) {
$thumb['url'] = $new_thumb;
$json_thumb = Arr::a2s($thumb);
if (strlen($json_thumb) <= 500) {
$product->timestamps = false;
$product->thumb = Arr::a2s($thumb);
$product->thumb = $json_thumb;
$product->save();
$this->output('product_id:' . $product->id . ' | success');
$this->output('project_id:' . $product->project_id . ',product_id:' . $product->id . ' | success');
}
}
}
}
... ...