|
|
|
@ -3,6 +3,7 @@ |
|
|
|
namespace App\Controller\v3; |
|
|
|
|
|
|
|
use App\Controller\BaseController; |
|
|
|
use App\Service\v3\Interfaces\ShopCartServiceInterface; |
|
|
|
use App\Service\v3\Implementations\GoodsActivityService; |
|
|
|
use App\Service\v3\Interfaces\CollectStoreServiceInterface; |
|
|
|
use Hyperf\Di\Annotation\Inject; |
|
|
|
@ -29,18 +30,26 @@ class GoodsController extends BaseController |
|
|
|
*/ |
|
|
|
protected $collectService; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Inject |
|
|
|
* @var ShopCartServiceInterface |
|
|
|
*/ |
|
|
|
protected $shopCartService; |
|
|
|
|
|
|
|
public function detail() |
|
|
|
{ |
|
|
|
$params = $this->request->all(); |
|
|
|
//判断是普通商品还是特价商品
|
|
|
|
if(isset($params['activity']) && $params['activity'] == Goods::IS_ACTIVITY){ |
|
|
|
$res['detail'] = $this->goodsActivityService->do($params['goods_id']); |
|
|
|
$res['detail'] = $this->goodsActivityService->detail($params['goods_id']); |
|
|
|
$res['banner'] = $this->goodsActivityService->getBanner(); |
|
|
|
}else{ |
|
|
|
$res['detail'] = $this->goodsService->do($params['goods_id']); |
|
|
|
$res['detail'] = $this->goodsService->detail($params['goods_id']); |
|
|
|
$res['banner'] = $this->goodsService->getBanner(); |
|
|
|
} |
|
|
|
if(isset($params['user_id'])) { |
|
|
|
$res['shopcart']['check'] = $this->shopCartService->check(111); |
|
|
|
$res['shopcart']['total'] = $this->shopCartService->getTotal(); |
|
|
|
$res['detail']->store->is_collected = (bool)$this->collectService->check($params['user_id'], $params['store_id']); |
|
|
|
}else{ |
|
|
|
$res['detail']->store->is_collected = ''; |
|
|
|
|