This commit is contained in:
sjk
2025-11-28 15:18:10 +08:00
parent ad4a600af9
commit 5683f35942
188 changed files with 53680 additions and 1062 deletions

View File

@@ -27,13 +27,8 @@ func NewCartService(orderRepo *repository.OrderRepository, productRepo *reposito
}
// GetCart 获取购物车
// 优化: 移除用户存在性检查,因为中间件已经验证过token和用户
func (s *CartService) GetCart(userID uint) ([]model.Cart, error) {
// 检查用户是否存在
_, err := s.userRepo.GetByID(userID)
if err != nil {
return nil, errors.New("用户不存在")
}
return s.orderRepo.GetCart(userID)
}