From 07fb617c686699435cde29e8147f11a125d7d618 Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期一, 23 六月 2025 11:10:12 +0800
Subject: [PATCH] bug修改
---
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppLotteryEventController.java | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppLotteryEventController.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppLotteryEventController.java
index fdf0355..d71fcf8 100644
--- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppLotteryEventController.java
+++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppLotteryEventController.java
@@ -69,6 +69,16 @@
})
public R<LotteryEventVo> getLotteryEvent(@PathVariable("id") String id) {
LotteryEventVo lotteryEvent = lotteryEventService.getLotteryEvent(id);
+ TLotteryEvent event = lotteryEventService.getById(id);
+ if (LocalDateTime.now().isBefore(event.getStartTime())) {
+ lotteryEvent.setStatus(1);
+ }
+ if (LocalDateTime.now().isAfter(event.getEndTime())) {
+ lotteryEvent.setStatus(3);
+ }
+ if (LocalDateTime.now().isAfter(event.getStartTime()) && LocalDateTime.now().isBefore(event.getEndTime())) {
+ lotteryEvent.setStatus(2);
+ }
return R.ok(lotteryEvent);
}
@@ -79,7 +89,7 @@
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "抽奖活动id", required = true, dataType = "String", paramType = "path")
})
- public R lotteryDraw(@PathVariable("id") String id) {
+ public R<TLotteryEventPrize> lotteryDraw(@PathVariable("id") String id) {
return lotteryEventService.lotteryDraw(id);
}
@@ -96,13 +106,13 @@
activityPageVoList.forEach(vo -> {
String startTime = vo.getStartTime();
String endTime = vo.getEndTime();
- if (LocalDateTime.now().isBefore(LocalDateTime.parse(startTime))) {
+ if (LocalDateTime.now().isBefore(LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) {
vo.setStatus(1);
}
- if (LocalDateTime.now().isAfter(LocalDateTime.parse(endTime))) {
+ if (LocalDateTime.now().isAfter(LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) {
vo.setStatus(3);
}
- if (LocalDateTime.now().isAfter(LocalDateTime.parse(startTime)) && LocalDateTime.now().isBefore(LocalDateTime.parse(endTime))) {
+ if (LocalDateTime.now().isAfter(LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))) && LocalDateTime.now().isBefore(LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))) {
vo.setStatus(2);
}
});
@@ -124,6 +134,7 @@
vo.setName(lotteryEvent.getName());
vo.setActivityProfile(lotteryEvent.getActivityProfile());
vo.setStartTime(lotteryEvent.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+ vo.setEndTime(lotteryEvent.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
vo.setActivityContent(lotteryEvent.getActivityContent());
int count = userLotteryEventService.count(new QueryWrapper<TUserLotteryEvent>().eq("lottery_event_id", id).eq("user_id", userId));
vo.setParticipation(count > 0);
@@ -167,7 +178,7 @@
//上一题
Integer current = dto.getCurrent();
if (-1 == dto.getStepOrDown()) {
- if (current - 1 <= 0) {
+ if (current - 1 < 0) {
return R.fail("操作失败");
}
current--;
@@ -251,6 +262,9 @@
Long userId = SecurityUtils.getUserId();
TLotteryEvent lotteryEvent = lotteryEventService.getById(id);
TUserLotteryEventQuestions questionsServiceOne = userLotteryEventQuestionsService.getOne(new QueryWrapper<TUserLotteryEventQuestions>().eq("lottery_event_id", id).eq("user_id", userId));
+ if (null == questionsServiceOne) {
+ return R.fail("请先进行答题操作");
+ }
questionsServiceOne.setStatus(2);
questionsServiceOne.setEndTime(LocalDateTime.now());
//计算正确率
--
Gitblit v1.7.1