6
0
Fork 0

查看商品优化

release
李静 2021-12-13 14:32:53 +08:00
parent 4c863302fa
commit 1ac886306b
1 changed files with 3 additions and 11 deletions

View File

@ -45,17 +45,6 @@ class ProductSkuController extends Controller
$sku = ProductSku::with('buynote')->findOrFail($id);
// 是否收藏商品
$isCollected = (bool) $user?->skuFavorites()->where('sku_id', $sku->id)->exists();
if (! $sku->isOnline()) {
return response()->json([
'spu_specs' => [],
'sku' => ProduckSkuResource::make($sku),
'is_collected' => $isCollected,
]);
}
$spu = ProductSpu::with('specs')->findOrFail($sku->spu_id);
// 主商品的规格
@ -98,6 +87,9 @@ class ProductSkuController extends Controller
Viewed::dispatch($user, $sku, now());
// 是否收藏商品
$isCollected = (bool) $user?->skuFavorites()->where('sku_id', $sku->id)->exists();
return response()->json([
'spu_specs' => $spuSpecs,
'sku' => ProduckSkuResource::make($sku),