Commit 9bdab0d2 by liumengfei

Y优化数据结构

parent 674ecee7
......@@ -76,9 +76,10 @@ class GalleryManagement implements \Joshine\Catalog\Api\ProductAttributeMediaGal
if (empty($content)) {
return 0;
}
$ids = true;
$ids = [];
$sku = $content[0]['sku'];
foreach ($content as $entry){
$this->entry->setMediaType($entry['media_type']);
$this->entry->setDisabled($entry['disabled']);
$this->entry->setFile($entry['file']);
......@@ -92,15 +93,24 @@ class GalleryManagement implements \Joshine\Catalog\Api\ProductAttributeMediaGal
$imageContent->setType($entry['content']['type']);
$this->entry->setContent($imageContent);
$id = $this->create($sku,$this->entry);
if (!is_numeric((int)$id)){
$ids = false;
if (is_numeric((int)$id)){
$ids []= (int)$id;
}
}
if (!$ids){
throw new StateException(__('Batch upload of product images failed'));
}
return $this->getList($sku);
$list = $this->getList($sku);
foreach ($list as $key => $v) {
if (!in_array($v->getId(),$ids)) {
unset($list[$key]);
}
}
array_multisort($list);
return $list;
}
......
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 to comment