From b302b2e7965ea09d6ac441e07349d35397ebca47 Mon Sep 17 00:00:00 2001 From: zpc Date: Sat, 7 Feb 2026 17:40:38 +0800 Subject: [PATCH] 21 --- .../HoneyBox.Admin.Business/Services/UserBusinessService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/HoneyBox/src/HoneyBox.Admin.Business/Services/UserBusinessService.cs b/server/HoneyBox/src/HoneyBox.Admin.Business/Services/UserBusinessService.cs index ac1980f6..ed827492 100644 --- a/server/HoneyBox/src/HoneyBox.Admin.Business/Services/UserBusinessService.cs +++ b/server/HoneyBox/src/HoneyBox.Admin.Business/Services/UserBusinessService.cs @@ -350,8 +350,8 @@ public class UserBusinessService : IUserBusinessService throw new BusinessException(BusinessErrorCodes.NotFound, "用户不存在"); } - // 获取优惠券模板 - var coupon = await _dbContext.Coupons.FirstOrDefaultAsync(c => c.Id == request.CouponId && c.Status == 1); + // 获取优惠券模板 (status=0 表示有效/上架) + var coupon = await _dbContext.Coupons.FirstOrDefaultAsync(c => c.Id == request.CouponId && c.Status == 0); if (coupon == null) { throw new BusinessException(BusinessErrorCodes.NotFound, "优惠券不存在或已禁用");