Browse Source

商品详情

master
Lemon 5 years ago
parent
commit
5da26902c5
  1. 4
      app/Controller/v3/GoodsController.php
  2. 4
      app/Service/v3/Implementations/GoodsActivityService.php
  3. 4
      app/Service/v3/Implementations/GoodsService.php
  4. 2
      app/Service/v3/Interfaces/GoodsActivityServiceInterface.php
  5. 2
      app/Service/v3/Interfaces/GoodsServiceInterface.php

4
app/Controller/v3/GoodsController.php

@ -42,10 +42,10 @@ class GoodsController extends BaseController
//判断是普通商品还是特价商品
if(isset($params['activity']) && $params['activity'] == Goods::IS_ACTIVITY){
$res['detail'] = $this->goodsActivityService->detail($params['goods_id']);
$res['banner'] = $this->goodsActivityService->getBanner();
$res['banner'] = $this->goodsActivityService->getBanner(1572);
}else{
$res['detail'] = $this->goodsService->detail($params['goods_id']);
$res['banner'] = $this->goodsService->getBanner();
$res['banner'] = $this->goodsService->getBanner(1572);
}
if(isset($params['user_id'])) {
$res['shopcart']['count'] = $this->shopCartService->check(111);

4
app/Service/v3/Implementations/GoodsActivityService.php

@ -44,9 +44,9 @@ class GoodsActivityService implements GoodsActivityServiceInterface
// TODO: Implement undo() method.
}
public function getBanner()
public function getBanner($goodsId)
{
$banner = GoodsActivityBanner::query()->where('goods_id',1572)->orderByDesc('type')->get();
$banner = GoodsActivityBanner::query()->where('goods_id',$goodsId)->orderByDesc('type')->get();
return $banner;
}

4
app/Service/v3/Implementations/GoodsService.php

@ -39,9 +39,9 @@ class GoodsService implements GoodsServiceInterface
// TODO: Implement undo() method.
}
public function getBanner()
public function getBanner($goodsId)
{
$banner = GoodsBanner::query()->where('goods_id',1572)->orderByDesc('type')->get();
$banner = GoodsBanner::query()->where('goods_id',$goodsId)->orderByDesc('type')->get();
return $banner;
}

2
app/Service/v3/Interfaces/GoodsActivityServiceInterface.php

@ -7,6 +7,6 @@ interface GoodsActivityServiceInterface
public function do($goodsId);
public function check($goodsId,$num = 1);
public function undo();
public function getBanner();
public function getBanner($goodsId);
public function detail($goodsId);
}

2
app/Service/v3/Interfaces/GoodsServiceInterface.php

@ -7,5 +7,5 @@ interface GoodsServiceInterface
public function do($goodsId);
public function check($goodsId,$num = 1);
public function undo();
public function getBanner();
public function getBanner($goodsId);
}
Loading…
Cancel
Save