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.
29 lines
624 B
29 lines
624 B
2 years ago
|
package service
|
||
|
|
||
|
import (
|
||
|
"goproduct/domain/model"
|
||
|
"goproduct/domain/repository"
|
||
|
"goproduct/proto"
|
||
|
)
|
||
|
|
||
|
type ICartService interface {
|
||
|
AddCart(*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)
|
||
|
}
|