红包校验抛出错误码

This commit is contained in:
tianfeng 2025-11-26 17:50:52 +08:00
parent cdd73bfc03
commit d5d28bc6a1
2 changed files with 4 additions and 10 deletions

View File

@ -106,15 +106,9 @@ public class GrabRoomRedPacketCmdExe {
* 检查红包状态 * 检查红包状态
*/ */
private void checkRedPacketStatus(RoomRedPacket redPacket) { private void checkRedPacketStatus(RoomRedPacket redPacket) {
if (RoomRedPacketStatus.FINISHED.getCode().equals(redPacket.getStatus())) { ResponseAssert.isFalse(OtherErrorCode.RED_PACKET_FINISHED, RoomRedPacketStatus.FINISHED.getCode().equals(redPacket.getStatus()));
throw new RuntimeException(OtherErrorCode.RED_PACKET_FINISHED.getMessage()); ResponseAssert.isFalse(OtherErrorCode.RED_PACKET_EXPIRED, RoomRedPacketStatus.EXPIRED.getCode().equals(redPacket.getStatus()));
} ResponseAssert.isFalse(OtherErrorCode.RED_PACKET_EXPIRED, LocalDateTime.now().isAfter(redPacket.getExpireTime()));
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());
}
} }
/** /**

View File

@ -90,7 +90,7 @@
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM room_red_packet FROM room_red_packet
WHERE room_id = #{roomId} AND status != 3 WHERE room_id = #{roomId} AND status = 1
ORDER BY create_time DESC ORDER BY create_time DESC
LIMIT #{offset}, #{size} LIMIT #{offset}, #{size}
</select> </select>