package com.ylx.lottery;

import com.ylx.common.core.domain.R;
import com.ylx.lottery.domain.dto.IsLotteryDTO;
import com.ylx.lottery.domain.vo.IsLotteryVO;
import com.ylx.lottery.service.LotteryCountLogService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
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;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/lottery")
public class LotteryController {

    @Resource
    private LotteryCountLogService lotteryCountLogService;

    @ApiOperation("根据活动类型判断是否可以抽奖")
    @PostMapping("/isLottery")
    public R<IsLotteryVO> isLottery(@Validated @RequestBody IsLotteryDTO dto) {
        IsLotteryVO vo = this.lotteryCountLogService.isLottery(dto);
        return R.ok(vo);
    }

}
