Revert "feat(notification):临时绕过授权检查逻辑"

This reverts commit 927c4955f8.
This commit is contained in:
2025-10-21 22:35:08 +08:00
parent 37033f1b16
commit 2d2ed6fc1b

View File

@@ -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;
}
}
/**