|
|
@ -197,28 +197,32 @@ class Goods extends GoodsModel |
|
|
|
'store_id' => request()->header()['storeid'], |
|
|
|
'store_id' => request()->header()['storeid'], |
|
|
|
'is_delete' => 0 |
|
|
|
'is_delete' => 0 |
|
|
|
])->column('goods_id'); |
|
|
|
])->column('goods_id'); |
|
|
|
foreach ($spe as $v) { |
|
|
|
foreach ($spe as $k => $v) { |
|
|
|
$sku1 = $this->getSpecData($v)['skuList']->toArray()[0]; |
|
|
|
//$sku1 = $this->getSpecData($v)['skuList']->toArray()[0]; |
|
|
|
|
|
|
|
// $skuList[] = $sku1; |
|
|
|
// foreach ($sku1['spec_value_ids'] as $k3 => &$v3) { |
|
|
|
$spe1 = $this->getSpecData($v)['specList'][0]; |
|
|
|
// $v3 = (int)$v3; |
|
|
|
$spe1['valueList'][0]['goods_id'] = $v; |
|
|
|
// } |
|
|
|
$aa = 0; |
|
|
|
|
|
|
|
foreach ($specList as &$v2) { |
|
|
|
|
|
|
|
if ($v2['spec_name'] == $spe1['spec_name']) { |
|
|
|
|
|
|
|
$aa = 1; |
|
|
|
|
|
|
|
$v2['valueList'][] = $spe1['valueList']; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$skuList[] = $sku1; |
|
|
|
if ($aa == 0) { |
|
|
|
$specList[] = $this->getSpecData($v)['specList'][0]; |
|
|
|
$specList[] = $spe1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$newList = [ |
|
|
|
|
|
|
|
'skuList' => $skuList, |
|
|
|
|
|
|
|
'specList' => $specList |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
$goodsInfo->specifications = $newList; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$goodsInfo = $goodsInfo->toArray(); |
|
|
|
$goodsInfo = $goodsInfo->toArray(); |
|
|
|
|
|
|
|
|
|
|
|
//替换原规格数组 |
|
|
|
//替换原规格数组 |
|
|
|
$goodsInfo['skuList2'] = $skuList; |
|
|
|
// $goodsInfo['skuList2'] = $skuList; |
|
|
|
$goodsInfo['specList2'] = $specList; |
|
|
|
$goodsInfo['specList2'] = $specList ?? []; |
|
|
|
|
|
|
|
|
|
|
|
//加入足迹 |
|
|
|
//加入足迹 |
|
|
|
$userId = UserService::getCurrentLoginUserId(false) ?? ''; |
|
|
|
$userId = UserService::getCurrentLoginUserId(false) ?? ''; |
|
|
|
if ($userId) { |
|
|
|
if ($userId) { |
|
|
|