diff --git a/app/Controller/v3/GoodsController.php b/app/Controller/v3/GoodsController.php index dd8bdf2..280eca7 100644 --- a/app/Controller/v3/GoodsController.php +++ b/app/Controller/v3/GoodsController.php @@ -47,6 +47,12 @@ class GoodsController extends BaseController $res['detail'] = $this->goodsService->detail($params['goods_id']); $res['banner'] = $this->goodsService->getBanner(1572); } + + //如果没有banner数据,使用商品cover图 + if(count($res['banner']) == 0){ + $res['banner'] = [$res['detail']['cover_img']]; + } + if(isset($params['user_id'])) { $res['shopcart']['count'] = $this->shopCartService->check(111); $res['shopcart']['total'] = $this->shopCartService->getTotal();