You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
830 B

package service
import (
"goproduct/domain/model"
"goproduct/domain/repository"
"goproduct/proto"
)
type ICartService interface {
AddCart(*proto.AddCartReq) (obj *model.ShoppingCart, err error)
UpdateCart(*proto.AddCartReq) (obj *model.ShoppingCart, err error)
}
type CartService struct {
cartRepository repository.ICartRepository
}
func NewCartService(cartRepository repository.ICartRepository) ICartService {
return &CartService{cartRepository: cartRepository}
}
// "number": 0,
//
// "productId": 0,
// "productSkuId": 0
//
// 重写接口方法
func (u *CartService) AddCart(req *proto.AddCartReq) (obj *model.ShoppingCart, err error) {
return u.cartRepository.AddCart(req)
}
func (u *CartService) UpdateCart(req *proto.AddCartReq) (obj *model.ShoppingCart, err error) {
return u.cartRepository.UpdateCart(req)
}