
package com.tmerclub.cloud.multishop.controller.app;

import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.multishop.service.HotSearchService;
import com.tmerclub.cloud.multishop.vo.HotSearchVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 热搜
 *
 * @author YXF
 * @date 2021-01-27 09:10:00
 */
@RestController("appHotSearchController")
@RequestMapping("/ua/app/hotQuery")
@Tag(name = "app-热搜")
public class HotSearchController {

    @Autowired
    private HotSearchService hotSearchService;

    @GetMapping("/list")
    @Operation(summary = "获取热搜列表", description = "获取热搜列表")
    @Parameters({
            @Parameter(name = "shopId", description = "店铺id"),
            @Parameter(name = "type", description = "1:商品热搜 2:店铺热搜")
    })
    public ServerResponseEntity<List<HotSearchVO>> listByShopId(@RequestParam("shopId") Long shopId, @RequestParam("type") Integer type) {
        List<HotSearchVO> hotSearches = hotSearchService.listByShopId(shopId, type);
        return ServerResponseEntity.success(hotSearches);
    }
}
