|
@@ -112,6 +112,9 @@ class Goods extends GoodsModel
|
|
|
$with = ['images.file', 'skuList.image', 'video', 'videoCover'];
|
|
|
// 获取商品记录
|
|
|
$goodsInfo = $this->getGoodsMain($goodsId, $with, $verifyStatus);
|
|
|
+ if(empty($goodsInfo['goods_id'])){
|
|
|
+ return $goodsInfo;
|
|
|
+ }
|
|
|
// 商品规格列表
|
|
|
$goodsInfo['specList'] = GoodsSpecRelModel::getSpecList($goodsInfo['goods_id']);
|
|
|
return $goodsInfo->hidden(array_merge($this->hidden, ['images']));
|
|
@@ -164,11 +167,11 @@ class Goods extends GoodsModel
|
|
|
$goodsInfo = static::detail($goodsId, $with);
|
|
|
// 判断商品是否存在
|
|
|
if (empty($goodsInfo) || $goodsInfo['is_delete']) {
|
|
|
- throwError('很抱歉,商品信息不存在');
|
|
|
+ return throwErrorInfo('Non-existent goods.');
|
|
|
}
|
|
|
// 判断商品状态(上架)
|
|
|
if ($verifyStatus && $goodsInfo['status'] == GoodsStatusEnum::OFF_SALE) {
|
|
|
- throwError('很抱歉,当前商品已下架');
|
|
|
+ return throwErrorInfo('Products that have been removed from the shelves.');
|
|
|
}
|
|
|
// 整理商品数据并返回
|
|
|
return $this->setGoodsDataFromApi($goodsInfo);
|