|
|
@ -187,6 +187,8 @@ class Goods extends GoodsModel |
|
|
|
$goodsInfo->category = $category; |
|
|
|
$goodsInfo->category = $category; |
|
|
|
//多规格 |
|
|
|
//多规格 |
|
|
|
$goodsInfo->specifications = []; |
|
|
|
$goodsInfo->specifications = []; |
|
|
|
|
|
|
|
$skuList = []; |
|
|
|
|
|
|
|
$specList = []; |
|
|
|
if ($goodsInfo->spu_id > 0) { |
|
|
|
if ($goodsInfo->spu_id > 0) { |
|
|
|
//查同规格的商品 |
|
|
|
//查同规格的商品 |
|
|
|
$spe = GoodsModel::where([ |
|
|
|
$spe = GoodsModel::where([ |
|
|
@ -194,11 +196,9 @@ 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'); |
|
|
|
$skuList = []; |
|
|
|
|
|
|
|
$specList = []; |
|
|
|
|
|
|
|
foreach ($spe as $v) { |
|
|
|
foreach ($spe as $v) { |
|
|
|
$skuList = $this->getSpecData($v)['skuList']->toArray()[0]; |
|
|
|
$skuList[] = $this->getSpecData($v)['skuList']->toArray()[0]; |
|
|
|
$specList = $this->getSpecData($v)['specList'][0]; |
|
|
|
$specList[] = $this->getSpecData($v)['specList'][0]; |
|
|
|
} |
|
|
|
} |
|
|
|
$newList = [ |
|
|
|
$newList = [ |
|
|
|
'skuList' => $skuList, |
|
|
|
'skuList' => $skuList, |
|
|
@ -206,6 +206,10 @@ class Goods extends GoodsModel |
|
|
|
]; |
|
|
|
]; |
|
|
|
$goodsInfo->specifications = $newList; |
|
|
|
$goodsInfo->specifications = $newList; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$goodsInfo = $goodsInfo->toArray(); |
|
|
|
|
|
|
|
//替换原规格数组 |
|
|
|
|
|
|
|
$goodsInfo['skuList2'] = $skuList; |
|
|
|
|
|
|
|
$goodsInfo['specList2'] = $specList; |
|
|
|
//加入足迹 |
|
|
|
//加入足迹 |
|
|
|
$userId = UserService::getCurrentLoginUserId(false) ?? ''; |
|
|
|
$userId = UserService::getCurrentLoginUserId(false) ?? ''; |
|
|
|
if ($userId) { |
|
|
|
if ($userId) { |
|
|
@ -225,7 +229,7 @@ class Goods extends GoodsModel |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $goodsInfo->hidden(static::getHidden(['images'])); |
|
|
|
return $goodsInfo; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getDetails2(int $goodsId, bool $verifyStatus = true) |
|
|
|
public function getDetails2(int $goodsId, bool $verifyStatus = true) |
|
|
|