From 2d2ed6fc1b39d5ab600073b3670c0696536cd0c1 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Tue, 21 Oct 2025 22:35:08 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"feat(notification):=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E7=BB=95=E8=BF=87=E6=8E=88=E6=9D=83=E6=A3=80=E6=9F=A5=E9=80=BB?= =?UTF-8?q?=E8=BE=91"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 927c4955f844a17ad5b99da7374cd748c7444069. --- .../basic/utils/NotificationAuthUtils.java | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/ycwl/basic/utils/NotificationAuthUtils.java b/src/main/java/com/ycwl/basic/utils/NotificationAuthUtils.java index ca69db13..873e2ad6 100644 --- a/src/main/java/com/ycwl/basic/utils/NotificationAuthUtils.java +++ b/src/main/java/com/ycwl/basic/utils/NotificationAuthUtils.java @@ -92,23 +92,21 @@ public class NotificationAuthUtils { * @return 是否检查并消费成功 */ public boolean checkAndConsumeAuthorization(Long memberId, String templateId, Long scenicId) { - // 测试 - return true; -// try { -// // 先检查剩余次数 -// Integer remainingCount = userNotificationAuthorizationService.getRemainingCount(memberId, templateId, scenicId); -// if (remainingCount == null || remainingCount <= 0) { -// log.debug("用户剩余授权次数不足: memberId={}, templateId={}, scenicId={}, remainingCount={}", -// memberId, templateId, scenicId, remainingCount); -// return false; -// } -// -// // 尝试消费 -// return consumeAuthorization(memberId, templateId, scenicId); -// } catch (Exception e) { -// log.error("检查并消费授权异常: memberId={}, templateId={}, scenicId={}", memberId, templateId, scenicId, e); -// return false; -// } + try { + // 先检查剩余次数 + Integer remainingCount = userNotificationAuthorizationService.getRemainingCount(memberId, templateId, scenicId); + if (remainingCount == null || remainingCount <= 0) { + log.debug("用户剩余授权次数不足: memberId={}, templateId={}, scenicId={}, remainingCount={}", + memberId, templateId, scenicId, remainingCount); + return false; + } + + // 尝试消费 + return consumeAuthorization(memberId, templateId, scenicId); + } catch (Exception e) { + log.error("检查并消费授权异常: memberId={}, templateId={}, scenicId={}", memberId, templateId, scenicId, e); + return false; + } } /**