SearchController.java 863 字节
package com.aigeo.article.controller;

import com.aigeo.article.service.SearchService;
import com.aigeo.common.Result;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/search")
@Tag(name = "搜索", description = "搜索功能相关接口")
public class SearchController {

    @Autowired
    private SearchService searchService;

    @PostMapping("/keywords")
    public Result<String> searchKeywords(@RequestBody String keywords) {
        searchService.search(keywords);
        return Result.success("");
    }
}