package com.playlet.web.controller.app;

import com.playlet.common.core.domain.Result;
import com.playlet.system.domain.PlayletRealizationProject;
import com.playlet.web.service.app.PlayletRealizationProjectAppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@Api(tags = "小程序*短剧变现项目接口")
@RestController
@RequestMapping(value = "/app/project")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PlayletRealizationProjectAppController {

    private final PlayletRealizationProjectAppService playletRealizationProjectAppService;

    @ResponseBody
    @PostMapping(value = "/getProjectList")
    @ApiOperation(value = "获取变现项目", httpMethod = "POST")
    public Result<List<PlayletRealizationProject>> getProjectList(@RequestBody PlayletRealizationProject playletRealizationProject){
        try {
            return Result.success(playletRealizationProjectAppService.getProjectList(playletRealizationProject));
        }catch (Exception e){
            return Result.error(e.getMessage());
        }
    }

}
