package com.playlet.web.controller.app;

import com.playlet.common.core.domain.Result;
import com.playlet.system.domain.PlayletBanner;
import com.playlet.web.service.app.PlayletBannerAppService;
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/banner")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PlayletBannerAppController {

    private final PlayletBannerAppService playletBannerService;

    @ResponseBody
    @PostMapping(value = "/getBannerList")
    @ApiOperation(value = "获取轮播图资料", httpMethod = "POST")
    public Result<List<PlayletBanner>> getBannerList(@RequestBody PlayletBanner playletBanner){
        try {
            return Result.success(playletBannerService.getBannerList(playletBanner));
        }catch (Exception e){
            return Result.error(e.getMessage());
        }
    }

}
