web
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user