This commit is contained in:
zpc 2026-02-07 17:40:38 +08:00
parent 7180f570fe
commit b302b2e796

View File

@ -350,8 +350,8 @@ public class UserBusinessService : IUserBusinessService
throw new BusinessException(BusinessErrorCodes.NotFound, "用户不存在"); throw new BusinessException(BusinessErrorCodes.NotFound, "用户不存在");
} }
// 获取优惠券模板 // 获取优惠券模板 (status=0 表示有效/上架)
var coupon = await _dbContext.Coupons.FirstOrDefaultAsync(c => c.Id == request.CouponId && c.Status == 1); var coupon = await _dbContext.Coupons.FirstOrDefaultAsync(c => c.Id == request.CouponId && c.Status == 0);
if (coupon == null) if (coupon == null)
{ {
throw new BusinessException(BusinessErrorCodes.NotFound, "优惠券不存在或已禁用"); throw new BusinessException(BusinessErrorCodes.NotFound, "优惠券不存在或已禁用");