package com.ruoyi.web.modules.home.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.modules.home.dto.SearchQuery;
import com.ruoyi.web.modules.home.service.ISearchAppService;

/**
 * C 端全站搜索（商品 + 店铺统一检索）
 */
@RestController
@RequestMapping("/api/search")
public class SearchAppController extends BaseController
{
    @Autowired
    private ISearchAppService searchAppService;

    @Anonymous
    @GetMapping
    public AjaxResult search(SearchQuery query)
    {
        return success(searchAppService.search(query));
    }
}
