From 8c2a413d2574151a2bc762aa0779f766de48160b Mon Sep 17 00:00:00 2001
From: phpcjl <phpcjl@gmail.com>
Date: 星期一, 16 十二月 2024 18:14:01 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java |   51 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java
index 7ee1c06..5b5b1f6 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java
@@ -6,15 +6,13 @@
 import com.ruoyi.other.api.domain.RedPackegeSet;
 import com.ruoyi.other.service.RedPackegeSetService;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.util.List;
 
 /**
  * <p>
@@ -43,5 +41,48 @@
         }
     }
 
+
+    /**
+     * 获取红包配置
+     */
+    @ApiOperation(value = "获取红包配置", tags = {"管理后台-活动管理-签到红包"})
+    @GetMapping("/getRedPackegeSet")
+    public R<RedPackegeSet> getRedPackegeSet(){
+        return R.ok(redPackegeSetService.getOne(null));
+    }
+
+
+    /**
+     * 添加红包配置
+     */
+    @ApiOperation(value = "添加红包配置", tags = {"管理后台-活动管理-签到红包"})
+    @PostMapping("/addRedPackegeSet")
+    @Transactional(rollbackFor = Exception.class)
+    public R<Void> addRedPackegeSet(@RequestBody List<RedPackegeSet> redPackegeSets){
+        for (RedPackegeSet redPackegeSet : redPackegeSets) {
+            RedPackegeSet one = redPackegeSetService.getOne(null);
+            if (one==null){
+                redPackegeSet.setId(1);
+                redPackegeSetService.save(redPackegeSet);
+            }else {
+                if (one.getId()==null){
+                    return R.fail("参数错误");
+                }
+                redPackegeSetService.updateById(redPackegeSet);
+            }
+        }
+        return R.ok();
+    }
+
+    /**
+     * 删除红包配置
+     */
+    @ApiOperation(value = "删除红包配置", tags = {"管理后台-活动管理-签到红包"})
+    @GetMapping("/delRedPackegeSet")
+    public R<Void> delRedPackegeSet(){
+        redPackegeSetService.removeById(1);
+        return R.ok();
+    }
+
 }
 

--
Gitblit v1.7.1