You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.5 KiB
50 lines
1.5 KiB
<?php
|
|
|
|
namespace App\Controller\v3;
|
|
|
|
use App\Controller\BaseController;
|
|
use App\Service\v3\Implementations\GoodsActivityService;
|
|
use App\Service\v3\Interfaces\CollectStoreServiceInterface;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
use App\Service\v3\Interfaces\GoodsServiceInterface;
|
|
use App\Service\v3\Interfaces\GoodsActivityServiceInterface;
|
|
use App\Constants\v3\Goods;
|
|
class GoodsController extends BaseController
|
|
{
|
|
/**
|
|
* @Inject
|
|
* @var GoodsServiceInterface
|
|
*/
|
|
protected $goodsService;
|
|
|
|
/**
|
|
* @Inject
|
|
* @var GoodsActivityServiceInterface
|
|
*/
|
|
protected $goodsActivityService;
|
|
|
|
/**
|
|
* @Inject
|
|
* @var CollectStoreServiceInterface
|
|
*/
|
|
protected $collectService;
|
|
|
|
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['banner'] = $this->goodsActivityService->getBanner();
|
|
}else{
|
|
$res['detail'] = $this->goodsService->do($params['goods_id']);
|
|
$res['banner'] = $this->goodsService->getBanner();
|
|
}
|
|
if(isset($params['user_id'])) {
|
|
$res['detail']->store->is_collected = (bool)$this->collectService->check($params['user_id'], $params['store_id']);
|
|
}else{
|
|
$res['detail']->store->is_collected = '';
|
|
}
|
|
return $this->success($res);
|
|
}
|
|
}
|