From d263241445ddbb8e947e2e9a386ef8ab520df300 Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Sat, 15 Apr 2023 11:05:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=90=AF=E9=98=9F=E5=88=97=E5=90=8E?= =?UTF-8?q?=E9=87=87=E9=9B=86=E5=95=86=E5=93=81=E7=9A=84=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/jobs/ProductCopyJob.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crmeb/app/jobs/ProductCopyJob.php b/crmeb/app/jobs/ProductCopyJob.php index 8941bbc59..14ef48cc8 100644 --- a/crmeb/app/jobs/ProductCopyJob.php +++ b/crmeb/app/jobs/ProductCopyJob.php @@ -48,7 +48,7 @@ class ProductCopyJob extends BaseJobs $d_image = 'http://' . ltrim($image, '\//'); } $description_cache = CacheService::get('desc_images_' . $id); - if ($description_cache === null) { + if ($description_cache === null || $description_cache === '') { $description_cache = $description; CacheService::set('desc_images_count' . $id, 0); } @@ -64,7 +64,7 @@ class ProductCopyJob extends BaseJobs CacheService::set('desc_images_count' . $id, $desc_count); } } catch (\Throwable $e) { - Log::error('下载商品详情图片失败,失败原因:' . $e->getMessage()); + Log::error('下载商品详情图片失败,失败原因:' . $e->getMessage() . '_' . $e->getFile() . '_' . $e->getLine()); } return true; } @@ -86,9 +86,9 @@ class ProductCopyJob extends BaseJobs //下载图片 $res = $copyTaobao->downloadCopyImage($image); //获取缓存中的轮播图 - $slider_images = CacheService::get('slider_images_' . $id); + $slider_images = CacheService::get('slider_images_' . $id) ?? []; //缓存为null则赋值[] - if ($slider_images === null) $slider_images = []; + if ($slider_images === null || $slider_images === '') $slider_images = []; //将下载的图片插入数组 array_push($slider_images, $res); //如果$slider_images中图片数量和传入的$count相等,说明已经下载完成,写入商品表,如果不等则继续插入缓存 @@ -102,7 +102,7 @@ class ProductCopyJob extends BaseJobs CacheService::set('slider_images_' . $id, $slider_images); } } catch (\Throwable $e) { - Log::error('下载商品轮播图片失败,失败原因:' . $e->getMessage()); + Log::error('下载商品轮播图片失败,失败原因:' . $e->getMessage() . '_' . $e->getFile() . '_' . $e->getLine()); } return true; }