diff --git a/app/controller/api/Demo.php b/app/controller/api/Demo.php index dedd198a..1dc08689 100644 --- a/app/controller/api/Demo.php +++ b/app/controller/api/Demo.php @@ -136,17 +136,17 @@ class Demo extends BaseController Db::name('store_product')->where('product_id', $find['product_id'])->update($update); /**更新规格图片 */ foreach ($sku_arr as $k => $v) { - $sku = explode(',', $k); - if(count($sku)==2){ - $sku_name=$sku[0]; - }else{ - continue; - } - $store_product_attr_value = Db::name('store_product_attr_value')->where(['mer_id' => $mer_id, 'product_id' => $find['product_id'], 'sku' => $sku_name])->find(); + // $sku = explode(',', $k); + // if(count($sku)==2){ + // $sku_name=$sku[0]; + // }else{ + // continue; + // } + $store_product_attr_value = Db::name('store_product_attr_value')->where(['mer_id' => $mer_id, 'product_id' => $find['product_id'], 'sku' => $k])->find(); if ($store_product_attr_value) { $oss = $upload->to($dir)->stream(file_get_contents($v)); Db::name('store_product_attr_value') - ->where(['mer_id' => $mer_id, 'product_id' => $find['product_id'], 'sku' => $sku_name]) + ->where(['mer_id' => $mer_id, 'product_id' => $find['product_id'], 'sku' => $k]) ->update(['image' => $oss->filePath]); } } diff --git a/crmeb/jobs/ImportPicJob.php b/crmeb/jobs/ImportPicJob.php index d917b296..fbd93758 100644 --- a/crmeb/jobs/ImportPicJob.php +++ b/crmeb/jobs/ImportPicJob.php @@ -89,17 +89,17 @@ class ImportPicJob implements JobInterface Db::name('store_product')->where('product_id', $find['product_id'])->update($update); /**更新规格图片 */ foreach ($sku_arr as $k => $v) { - $sku = explode(',', $k); - if(count($sku)==2){ - $sku_name=$sku[0]; - }else{ - continue; - } - $store_product_attr_value = Db::name('store_product_attr_value')->where(['mer_id' => $mer_id, 'product_id' => $find['product_id'], 'sku' => $sku_name])->find(); + // $sku = explode(',', $k); + // if(count($sku)==2){ + // $sku_name=$sku[0]; + // }else{ + // continue; + // } + $store_product_attr_value = Db::name('store_product_attr_value')->where(['mer_id' => $mer_id, 'product_id' => $find['product_id'], 'sku' => $k])->find(); if ($store_product_attr_value) { $oss = $upload->to($dir)->stream(file_get_contents($v)); Db::name('store_product_attr_value') - ->where(['mer_id' => $mer_id, 'product_id' => $find['product_id'], 'sku' => $sku_name]) + ->where(['mer_id' => $mer_id, 'product_id' => $find['product_id'], 'sku' => $k]) ->update(['image' => $oss->filePath]); } }