From d9bcc1f955e1cddc6a38e55f769205a9330d3c89 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期二, 10 十二月 2024 17:06:37 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 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 43cc2f6..7ee1c06 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
@@ -1,9 +1,20 @@
 package com.ruoyi.other.controller;
 
 
+import com.ruoyi.account.api.model.AppUser;
+import com.ruoyi.common.core.domain.R;
+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 javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
 
 /**
  * <p>
@@ -16,6 +27,21 @@
 @RestController
 @RequestMapping("/red-packege-set")
 public class RedPackegeSetController {
+    @Resource
+    private RedPackegeSetService redPackegeSetService;
+    //获取当前生效的红包设置
+    @ResponseBody
+    @GetMapping("/get")
+    public R<BigDecimal> get(){
+        LocalDateTime now = LocalDateTime.now();
+        RedPackegeSet one = redPackegeSetService.lambdaQuery().le(RedPackegeSet::getStartTime, now).ge(RedPackegeSet::getEndTime, now).one();
+        if (one!=null){
+            return R.ok(one.getPackegeAmount());
+        }else {
+            return R.ok(BigDecimal.ZERO);
+
+        }
+    }
 
 }
 

--
Gitblit v1.7.1