This commit is contained in:
zpc 2026-02-06 00:36:32 +08:00
parent 3b6370f0e0
commit 8a36e8c2ac

View File

@ -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
/// <inheritdoc />
public async Task<GoodsDetailResponseDto> 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,