Browse Source

处理没有商品详情banner的情况

master
Mike 6 years ago
parent
commit
a74c12fe7d
  1. 6
      app/Controller/v3/GoodsController.php

6
app/Controller/v3/GoodsController.php

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

Loading…
Cancel
Save