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.
|
|
<?php
namespace App\Controller\v3;
use App\Controller\BaseController;use App\Request\v3\SearchGoodsRequest;use App\Service\v3\Interfaces\SearchServiceInterface;use Hyperf\Di\Annotation\Inject;use Psr\Http\Message\ResponseInterface;
class SearchController extends BaseController{ /** * @Inject * @var SearchServiceInterface */ protected $searchService;
/** * 获取搜索热词 * 1、参数type区分是商品还是商户 * 2、不同type处理不同的service获取热词 */ public function hotKeywords() {
$type = $this->request->input('type', 'goods'); $keywords = $this->searchService->getHotKeywords($type);
return $this->success(['keywords' => $keywords]); }
/** * 商品搜索 * 1、筛选条件:商品分类、商品关键词 * 2、排序:综合排序、销量最多、价格高/低 * 3、返回数据格式,大购物车统计+商品数据含有id、封面图、名称、原价、现价、库存、月销、tag、规格、购物车相关、商户id、商户avatar、商户名 * @param SearchGoodsRequest $request * @return ResponseInterface */ public function goods(SearchGoodsRequest $request) {
$params = $request->validated(); $data = $this->searchService->doForGoods($params);
return $this->success(['goods' => $data]); }
public function stores() {
}}
|