From a74c12fe7d75c3a4a6097e0e95b9d4f6ffda5904 Mon Sep 17 00:00:00 2001 From: Mike Date: Sat, 5 Sep 2020 17:48:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=B2=A1=E6=9C=89=E5=95=86?= =?UTF-8?q?=E5=93=81=E8=AF=A6=E6=83=85banner=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/v3/GoodsController.php | 6 ++++++ 1 file changed, 6 insertions(+) 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();