package com.platform.api;

import com.platform.annotation.IgnoreAuth;
import com.platform.entity.ApiTmSlideShowVo;
import com.platform.entity.Result;
import com.platform.service.custom.MyApiTmSlideShowService;
import com.platform.util.ApiBaseAction;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author abnerhou
 * @date 2020/9/11 20:09
 * @desciption
 */
@Api(tags = "小程序轮播图接口")
@RestController
@RequestMapping("/api/slideShow")
public class ApiTmSlideShowController extends ApiBaseAction {

    @Autowired
    private MyApiTmSlideShowService myApiTmSlideShowService;



    @ApiOperation(value = "根据Id获取轮播图详情")
    @IgnoreAuth
    @PostMapping("getSlideDetail")
    public Result getSlideDetailById(@RequestParam(name = "slideId") String slideId) {

        if (StringUtils.isEmpty(slideId)) {
            return Result.failure("轮播图ID不能为空");
        }
        ApiTmSlideShowVo slideShowVo = myApiTmSlideShowService.getSlideShowById(slideId);
        return Result.success(slideShowVo);
    }

    @ApiOperation(value = "获取top6轮播图")
    @IgnoreAuth
    @PostMapping("getSlideList")
    public Result getSlideList() {
        return Result.success(myApiTmSlideShowService.getTopSixSlideShow());
    }


}
