mitao
2024-05-31 d5cd5518fb4c9ec771dbf3d8db691fef36d18a45
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.ruoyi.auction.controller.inner;
 
 
import com.fasterxml.jackson.core.JsonProcessingException;
import com.ruoyi.auction.service.IAuctionGoodsService;
import com.ruoyi.common.core.domain.R;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
/**
 * <p>
 * 拍卖商品表 前端控制器
 * </p>
 *
 * @author mitao
 * @since 2024-05-16
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/auction-goods")
public class AuctionGoodsController {
 
    private final IAuctionGoodsService auctionGoodsService;
 
    @PutMapping("/auction-goods/end/{id}")
    R<?> endAuctionGoods(@PathVariable("id") Long id) {
        try {
            auctionGoodsService.endAuctionGoods(id);
        } catch (JsonProcessingException e) {
            log.error("结束拍卖商品异常", e);
            return R.fail();
        }
        return R.ok();
    }
 
    @PutMapping("/auction-goods/start/{id}")
    R<?> startAuctionGoods(@PathVariable("id") Long id) {
        try {
            auctionGoodsService.startAuctionGoods(id);
        } catch (JsonProcessingException e) {
            log.error("开始拍卖商品异常", e);
            return R.fail();
        }
        return R.ok();
    }
 
}