From d5d28bc6a13ef29ef2c7d57573ba2efe27a52e44 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Wed, 26 Nov 2025 17:50:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A2=E5=8C=85=E6=A0=A1=E9=AA=8C=E6=8A=9B?= =?UTF-8?q?=E5=87=BA=E9=94=99=E8=AF=AF=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../command/redpacket/GrabRoomRedPacketCmdExe.java | 12 +++--------- .../resources/dao/redpacket/RoomRedPacketDAO.xml | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/GrabRoomRedPacketCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/GrabRoomRedPacketCmdExe.java index e67d3d8a..ea9842e9 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/GrabRoomRedPacketCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/redpacket/GrabRoomRedPacketCmdExe.java @@ -106,15 +106,9 @@ public class GrabRoomRedPacketCmdExe { * 检查红包状态 */ private void checkRedPacketStatus(RoomRedPacket redPacket) { - if (RoomRedPacketStatus.FINISHED.getCode().equals(redPacket.getStatus())) { - throw new RuntimeException(OtherErrorCode.RED_PACKET_FINISHED.getMessage()); - } - if (RoomRedPacketStatus.EXPIRED.getCode().equals(redPacket.getStatus())) { - throw new RuntimeException(OtherErrorCode.RED_PACKET_EXPIRED.getMessage()); - } - if (LocalDateTime.now().isAfter(redPacket.getExpireTime())) { - throw new RuntimeException(OtherErrorCode.RED_PACKET_EXPIRED.getMessage()); - } + ResponseAssert.isFalse(OtherErrorCode.RED_PACKET_FINISHED, RoomRedPacketStatus.FINISHED.getCode().equals(redPacket.getStatus())); + ResponseAssert.isFalse(OtherErrorCode.RED_PACKET_EXPIRED, RoomRedPacketStatus.EXPIRED.getCode().equals(redPacket.getStatus())); + ResponseAssert.isFalse(OtherErrorCode.RED_PACKET_EXPIRED, LocalDateTime.now().isAfter(redPacket.getExpireTime())); } /** diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/redpacket/RoomRedPacketDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/redpacket/RoomRedPacketDAO.xml index c25ac7ad..ba08c484 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/redpacket/RoomRedPacketDAO.xml +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/redpacket/RoomRedPacketDAO.xml @@ -90,7 +90,7 @@ SELECT FROM room_red_packet - WHERE room_id = #{roomId} AND status != 3 + WHERE room_id = #{roomId} AND status = 1 ORDER BY create_time DESC LIMIT #{offset}, #{size}