mitao
2024-07-29 fc8b51f40e71aa09bb49f407c1e9f68ac94ceb58
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/inner/GoodsSeckillController.java
@@ -2,19 +2,18 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.security.annotation.InnerAuth;
import com.ruoyi.goods.service.IGoodsSeckillService;
import com.ruoyi.system.api.domain.GoodsSeckill;
import com.ruoyi.system.api.domain.GoodsSku;
import com.ruoyi.system.api.domain.dto.GoodsStockUpdDTO;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * <p>
@@ -32,12 +31,33 @@
    private final IGoodsSeckillService goodsSeckillService;
    @InnerAuth
    @PostMapping("/getGoodsSeckillOne")
    @ResponseBody
    public R<GoodsSeckill> getGoodsSeckillOne(@RequestBody Integer goodsSkuId) {
    public R<GoodsSeckill> getGoodsSeckillOne(@RequestBody Long goodsSkuId) {
        GoodsSeckill GoodsSeckillOne = goodsSeckillService.getById(goodsSkuId);
        return R.ok(GoodsSeckillOne);
    }
    @InnerAuth
    @PutMapping("/updGoodsSeckill")
    R<?> updGoodsSeckill(@RequestBody GoodsStockUpdDTO goodsStockUpdDTOS) {
        GoodsSeckill GoodsSeckillOne = goodsSeckillService.getById(goodsStockUpdDTOS.getGoodsSkuId());
        GoodsSeckillOne.setSeckillStock(goodsStockUpdDTOS.getAuctionStock());
        goodsSeckillService.updateById(GoodsSeckillOne);
        return R.ok();
    }
    @InnerAuth
    @PutMapping("/updGoodsSeckill1")
    R<Boolean> updGoodsSeckill1(@RequestBody GoodsSku goodsSku){
        GoodsSeckill GoodsSeckillOne = goodsSeckillService.getById(goodsSku.getId());
        Integer m= GoodsSeckillOne.getSoldQuantity()+goodsSku.getSoldQuantity();
        GoodsSeckillOne.setSoldQuantity(m);
        goodsSeckillService.updateById(GoodsSeckillOne);
        return R.ok();
    }
    /**
     * 开始秒杀
     *