From fe2d5b14031edbe43238770fb1fc21e8a322b51a Mon Sep 17 00:00:00 2001 From: rentaiming <806181062@qq.com> Date: 星期四, 13 六月 2024 18:18:08 +0800 Subject: [PATCH] 用户端商品 --- ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/inner/GoodsGroupPurchaseController.java | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-) diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/inner/GoodsGroupPurchaseController.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/inner/GoodsGroupPurchaseController.java index ebad70f..08c79fa 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/inner/GoodsGroupPurchaseController.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/inner/GoodsGroupPurchaseController.java @@ -1,15 +1,14 @@ package com.ruoyi.goods.controller.inner; +import com.fasterxml.jackson.core.JsonProcessingException; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.security.annotation.InnerAuth; +import com.ruoyi.system.api.domain.GoodsGroupPurchase; import com.ruoyi.goods.service.IGoodsGroupPurchaseService; 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; +import org.springframework.web.bind.annotation.*; /** * <p> @@ -27,6 +26,14 @@ private final IGoodsGroupPurchaseService goodsGroupPurchaseService; + @InnerAuth + @PostMapping("/getGoodsSeckiGoodsGroupPurchaseOne") + @ResponseBody + public R<GoodsGroupPurchase> getGoodsSeckiGoodsGroupPurchaseOne(@RequestBody Integer goodsSkuId) { + GoodsGroupPurchase GoodsSeckillOne = goodsGroupPurchaseService.getById(goodsSkuId); + return R.ok(GoodsSeckillOne); + } + /** * 团购商品开始团购 * @@ -35,7 +42,12 @@ @InnerAuth @GetMapping("/start/{groupPurchaseId}") R<?> startGroupPurchase(@PathVariable("groupPurchaseId") Long groupPurchaseId) { - goodsGroupPurchaseService.startGroupPurchase(groupPurchaseId); + try { + goodsGroupPurchaseService.startGroupPurchase(groupPurchaseId); + } catch (JsonProcessingException e) { + log.error("团购商品开始团购失败", e); + return R.fail("团购商品开始团购失败"); + } return R.ok(); } @@ -47,7 +59,12 @@ @InnerAuth @GetMapping("/end/{groupPurchaseId}") R<?> endGroupPurchase(@PathVariable("groupPurchaseId") Long groupPurchaseId) { - goodsGroupPurchaseService.endGroupPurchase(groupPurchaseId); + try { + goodsGroupPurchaseService.endGroupPurchase(groupPurchaseId); + } catch (JsonProcessingException e) { + log.error("团购商品开始团购失败", e); + return R.fail("团购商品结束团购失败"); + } return R.ok(); } } -- Gitblit v1.7.1