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.6 KiB

  1. <?php
  2. namespace App\Controller\v3;
  3. use App\Controller\BaseController;
  4. use App\Request\v3\StoreIndexRequest;
  5. use App\Service\v3\Interfaces\CategoryServiceInterface;
  6. use App\Service\v3\Interfaces\CollectStoreServiceInterface;
  7. use App\Service\v3\Interfaces\StoreServiceInterface;
  8. use Hyperf\Di\Annotation\Inject;
  9. use Psr\Http\Message\ResponseInterface;
  10. class StoreController extends BaseController
  11. {
  12. /**
  13. * @Inject
  14. * @var StoreServiceInterface
  15. */
  16. protected $storeService;
  17. /**
  18. * @Inject
  19. * @var CategoryServiceInterface
  20. */
  21. protected $categoryService;
  22. /**
  23. * @Inject
  24. * @var CollectStoreServiceInterface
  25. */
  26. protected $collectService;
  27. /**
  28. * 商户详情页
  29. * 1、商户id用来查询的,还要有user_id
  30. * 2、返回数据,id、logo、name、收藏状态、简介、地址、营业状态、营业时间、联系电话
  31. * 3、返回数据,商品推荐的分类,需要经过商户商品反查
  32. * 4、分类下的商品,则复用商品搜索接口
  33. * @param StoreIndexRequest $request
  34. * @return ResponseInterface
  35. */
  36. public function index(StoreIndexRequest $request)
  37. {
  38. $params = $request->validated();
  39. $data = $this->storeService->detail($params['store_id'], $params['market_id']);
  40. $data['is_collected'] = (bool)$this->collectService->check($params['market_id'], $params['store_id'], $params['user_id']);
  41. $data['goods_types'] = $this->categoryService->allForStore($params['store_id']);
  42. return $this->success(['store' => $data]);
  43. }
  44. }