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.
51 lines
1.6 KiB
51 lines
1.6 KiB
<?php
|
|
|
|
namespace App\Controller\v3;
|
|
|
|
use App\Controller\BaseController;
|
|
use App\Request\v3\StoreIndexRequest;
|
|
use App\Service\v3\Interfaces\CategoryServiceInterface;
|
|
use App\Service\v3\Interfaces\CollectStoreServiceInterface;
|
|
use App\Service\v3\Interfaces\StoreServiceInterface;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
|
class StoreController extends BaseController
|
|
{
|
|
|
|
/**
|
|
* @Inject
|
|
* @var StoreServiceInterface
|
|
*/
|
|
protected $storeService;
|
|
|
|
/**
|
|
* @Inject
|
|
* @var CategoryServiceInterface
|
|
*/
|
|
protected $categoryService;
|
|
|
|
/**
|
|
* @Inject
|
|
* @var CollectStoreServiceInterface
|
|
*/
|
|
protected $collectService;
|
|
|
|
/**
|
|
* 商户详情页
|
|
* 1、商户id用来查询的,还要有user_id
|
|
* 2、返回数据,id、logo、name、收藏状态、简介、地址、营业状态、营业时间、联系电话
|
|
* 3、返回数据,商品推荐的分类,需要经过商户商品反查
|
|
* 4、分类下的商品,则复用商品搜索接口
|
|
* @param StoreIndexRequest $request
|
|
* @return ResponseInterface
|
|
*/
|
|
public function index(StoreIndexRequest $request)
|
|
{
|
|
$params = $request->validated();
|
|
$data = $this->storeService->detail($params['store_id'], $params['market_id']);
|
|
$data['is_collected'] = (bool)$this->collectService->check($params['market_id'], $params['store_id'], $params['user_id']);
|
|
$data['goods_types'] = $this->categoryService->allForStore($params['store_id']);
|
|
return $this->success(['store' => $data]);
|
|
}
|
|
}
|