package com.tzld.longarticle.recommend.server.web;

import com.tzld.longarticle.recommend.server.model.RecommendRequest;
import com.tzld.longarticle.recommend.server.model.RecommendResponse;
import com.tzld.longarticle.recommend.server.service.RecommendService;
import com.tzld.longarticle.recommend.server.util.JSONUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dyp
 */
@RestController
@Slf4j
public class RecommendV2Controller {
    @Autowired
    private RecommendService recommendService;

    @RequestMapping("/homepage/recommend/v2")
    public String homepageRecommend(@RequestBody RecommendRequest httpRequest) {
        RecommendResponse response = recommendService.recommend(httpRequest);

        return JSONUtils.toJson(response);
    }

}
