From 2a873a04ab9c600b8e0836d1f866a66d87c4b64f Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 22 九月 2025 22:16:22 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppLotteryEventController.java |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 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 a4cb5c4..62e1ea7 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
@@ -63,13 +63,13 @@
 	
 	
 	@ResponseBody
-	@PostMapping("/getLotteryEvent/{id}")
+	@PostMapping("/getLotteryEvent/{id}/{orderId}")
 	@ApiOperation(value = "获取抽奖页详情【2.0】", tags = "抽奖活动")
 	@ApiImplicitParams({
 			@ApiImplicitParam(name = "id", value = "抽奖活动id", required = true, dataType = "String", paramType = "path")
 	})
-	public R<LotteryEventVo> getLotteryEvent(@PathVariable("id") String id) {
-		LotteryEventVo lotteryEvent = lotteryEventService.getLotteryEvent(id);
+	public R<LotteryEventVo> getLotteryEvent(@PathVariable("id") String id, @PathVariable("orderId") String orderId) {
+		LotteryEventVo lotteryEvent = lotteryEventService.getLotteryEvent(id, orderId);
 		TLotteryEvent event = lotteryEventService.getById(id);
 		if (LocalDateTime.now().isBefore(event.getStartTime())) {
 			lotteryEvent.setStatus(1);
@@ -85,13 +85,13 @@
 	
 	
 	@ResponseBody
-	@PostMapping("/lotteryDraw/{id}")
+	@PostMapping("/lotteryDraw/{id}/{orderId}")
 	@ApiOperation(value = "抽奖操作【2.0】", tags = "抽奖活动", notes = "返回奖品ID")
 	@ApiImplicitParams({
 			@ApiImplicitParam(name = "id", value = "抽奖活动id", required = true, dataType = "String", paramType = "path")
 	})
-	public R<TLotteryEventPrize> lotteryDraw(@PathVariable("id") String id) {
-		return lotteryEventService.lotteryDraw(id);
+	public R<TLotteryEventPrize> lotteryDraw(@PathVariable("id") String id, @PathVariable("orderId") String orderId) {
+		return lotteryEventService.lotteryDraw(id, orderId);
 	}
 	
 	
@@ -131,7 +131,7 @@
 		Long userId = SecurityUtils.getUserId();
 		TLotteryEvent lotteryEvent = lotteryEventService.getById(id);
 		LotteryEventInfoVo vo = new LotteryEventInfoVo();
-		vo.setId(lotteryEvent.getId());
+		vo.setId(lotteryEvent.getId().toString());
 		vo.setName(lotteryEvent.getName());
 		vo.setActivityProfile(lotteryEvent.getActivityProfile());
 		vo.setStartTime(lotteryEvent.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
@@ -209,12 +209,18 @@
 				map.put("name", item.getAnswers());
 				return map;
 			}).collect(Collectors.toList());
-			if (-1 == dto.getStepOrDown() || current == list.size() - 1) {
-				TUserLotteryEventQuestionsAnswers one = userLotteryEventQuestionsAnswersService.getOne(new QueryWrapper<TUserLotteryEventQuestionsAnswers>().eq("lottery_event_question_id", lotteryEventQuestions.getId()).eq("user_id", userId).orderByDesc("create_time").last(" limit 0, 1"));
-				if (null != one) {
-					vo.setAnswer(lotteryEventQuestionsAnswersService.getById(one.getLotteryEventQuestionsAnswersId()).getAnswers());
-				}
+
+			TUserLotteryEventQuestionsAnswers one = userLotteryEventQuestionsAnswersService.getOne(new QueryWrapper<TUserLotteryEventQuestionsAnswers>().eq("lottery_event_question_id", lotteryEventQuestions.getId()).eq("user_id", userId).orderByDesc("create_time").last(" limit 0, 1"));
+			if (null != one) {
+				vo.setAnswer(lotteryEventQuestionsAnswersService.getById(one.getLotteryEventQuestionsAnswersId()).getAnswers());
 			}
+
+//			if (-1 == dto.getStepOrDown() || current == list.size() - 1) {
+//				TUserLotteryEventQuestionsAnswers one = userLotteryEventQuestionsAnswersService.getOne(new QueryWrapper<TUserLotteryEventQuestionsAnswers>().eq("lottery_event_question_id", lotteryEventQuestions.getId()).eq("user_id", userId).orderByDesc("create_time").last(" limit 0, 1"));
+//				if (null != one) {
+//					vo.setAnswer(lotteryEventQuestionsAnswersService.getById(one.getLotteryEventQuestionsAnswersId()).getAnswers());
+//				}
+//			}
 			vo.setOptions(options);
 		}
 		return R.ok(vo);

--
Gitblit v1.7.1