Commit c82a7549 by 杨树贤

恢复批量处理

parent 524b055f
Showing with 23 additions and 23 deletions
......@@ -126,29 +126,29 @@ class DealImageService
if (empty($itemList['data']['goods_id'])) {
continue;
}
//foreach ($itemList['data']['goods_id'] as $skuId) {
// $skuDetail = DB::connection('mongo')->table('sku_detail')->where('sku_id', (string)$skuId)->first();
// $detail = $skuDetail['detail'];
// if (empty($detail)) {
// continue;
// }
// //替换图片地址并且上传
// $imageUrls = self::getAllImage($detail);
// if (empty($imageUrls)) {
// continue;
// }
// //dump($imageUrls); // 输出所有提取出的 'img.ichunt.com' 图片链接
// $imageMap = self::downloadAndUploadToPicServer($imageUrls);
// //进行全局替换
// foreach ($imageMap as $originImage => $newImage) {
// $detail = str_replace($originImage, $newImage, $detail);
// }
// //回写到mongo
// DB::connection('mongo')->table('sku_detail')->where('sku_id', (string)$skuId)->update([
// 'update_time' => time(),
// 'detail' => $detail,
// ]);
//}
foreach ($itemList['data']['goods_id'] as $skuId) {
$skuDetail = DB::connection('mongo')->table('sku_detail')->where('sku_id', (string)$skuId)->first();
$detail = $skuDetail['detail'];
if (empty($detail)) {
continue;
}
//替换图片地址并且上传
$imageUrls = self::getAllImage($detail);
if (empty($imageUrls)) {
continue;
}
//dump($imageUrls); // 输出所有提取出的 'img.ichunt.com' 图片链接
$imageMap = self::downloadAndUploadToPicServer($imageUrls);
//进行全局替换
foreach ($imageMap as $originImage => $newImage) {
$detail = str_replace($originImage, $newImage, $detail);
}
//回写到mongo
DB::connection('mongo')->table('sku_detail')->where('sku_id', (string)$skuId)->update([
'update_time' => time(),
'detail' => $detail,
]);
}
//break;
foreach ($itemList['data']['goods_id'] as $skuId) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment