|
|
@ -460,6 +460,18 @@ class Goods extends GoodsModel |
|
|
|
{ |
|
|
|
{ |
|
|
|
// 获取商品记录 |
|
|
|
// 获取商品记录 |
|
|
|
$goodsInfo = static::detail($goodsId, $with); |
|
|
|
$goodsInfo = static::detail($goodsId, $with); |
|
|
|
|
|
|
|
if ($goodsInfo->skuList) { |
|
|
|
|
|
|
|
foreach ($goodsInfo->skuList as &$value) { |
|
|
|
|
|
|
|
$goods_image = GoodsImage::where('goods_id', $value['goods_id'])->order("id asc")->find(); |
|
|
|
|
|
|
|
$file_path = UploadFile::where('file_id',$goods_image['image_id'] ?? 0)->find(); |
|
|
|
|
|
|
|
if ($file_path) { |
|
|
|
|
|
|
|
$value['image_url'] = getUrl($file_path['file_path'], $file_path['domain']); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$goods = GoodsModel::where('goods_id',$value['goods_id'])->find(); |
|
|
|
|
|
|
|
$value['stock_num'] = $goods['stock_total'] ?? 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
// 判断商品是否存在 |
|
|
|
// 判断商品是否存在 |
|
|
|
if (empty($goodsInfo) || $goodsInfo['is_delete']) { |
|
|
|
if (empty($goodsInfo) || $goodsInfo['is_delete']) { |
|
|
|
throwError('很抱歉,商品信息不存在'); |
|
|
|
throwError('很抱歉,商品信息不存在'); |
|
|
|