mitao
2024-05-23 d2c2889ad6405c66ac35ff68ef2438ef7aa65974
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/GoodsSeckillController.java
@@ -1,8 +1,13 @@
package com.ruoyi.goods.controller;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.goods.service.IGoodsSeckillService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
@@ -13,8 +18,34 @@
 * @author mitao
 * @since 2024-05-16
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/goods-seckill")
public class GoodsSeckillController {
    private final IGoodsSeckillService goodsSeckillService;
    /**
     * 开始秒杀
     *
     * @param seckillId 秒杀id
     */
    @GetMapping("/start/{seckillId}")
    R<?> startSeckill(@PathVariable("seckillId") Long seckillId) {
        goodsSeckillService.startSeckill(seckillId);
        return R.ok();
    }
    /**
     * 结束秒杀
     *
     * @param seckillId 秒杀id
     */
    @GetMapping("/end/{seckillId}")
    R<?> endSeckill(@PathVariable("seckillId") Long seckillId) {
        goodsSeckillService.endSeckill(seckillId);
        return R.ok();
    }
}