diff --git a/server/HoneyBox/src/HoneyBox.Core/Services/GoodsService.cs b/server/HoneyBox/src/HoneyBox.Core/Services/GoodsService.cs index 4e377aca..ef552416 100644 --- a/server/HoneyBox/src/HoneyBox.Core/Services/GoodsService.cs +++ b/server/HoneyBox/src/HoneyBox.Core/Services/GoodsService.cs @@ -77,9 +77,9 @@ public class GoodsService : IGoodsService } } - // 构建基础查询 + // 构建基础查询 - 排除已删除的商品 var query = _dbContext.Goods - .Where(g => g.Status == 1 && g.ShowIs == 0); + .Where(g => g.Status == 1 && g.ShowIs == 0 && g.DeletedAt == null); // 类型过滤 query = ApplyTypeFilter(query, type); @@ -368,9 +368,9 @@ public class GoodsService : IGoodsService /// public async Task GetGoodsDetailAsync(int goodsId, int goodsNum, int userId) { - // 1. 查询商品基本信息 + // 1. 查询商品基本信息(排除已删除的商品) var goods = await _dbContext.Goods - .Where(g => g.Id == goodsId) + .Where(g => g.Id == goodsId && g.DeletedAt == null) .Select(g => new { g.Id,