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.
34 lines
921 B
34 lines
921 B
package handler
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"goproduct/domain/service"
|
|
"goproduct/proto"
|
|
)
|
|
|
|
type CartHandler struct {
|
|
CartService service.ICartService
|
|
}
|
|
|
|
// 查询商品列表
|
|
func (u *CartHandler) AddCart(ctx context.Context, req *proto.AddCartReq, resp *proto.AddCartResp) error {
|
|
// "number": 0,
|
|
// "productId": 0,
|
|
// "productSkuId": 0
|
|
//obj, err := u.CartService.AddCart(req.GetNumber(), req.GetProductId(), req.GetProductSkuId())
|
|
obj, err := u.CartService.AddCart(req)
|
|
if err != nil {
|
|
println(" AddCart err :", err)
|
|
}
|
|
//count = u.ProductDataService.CountNum()
|
|
//fmt.Println(">>>>>>>>>>>>> page product success :", obj)
|
|
//cart := &proto.ShoppingCart{}
|
|
//err1 := common.SwapToStruct(obj, resp)
|
|
resp.CanSetShoppingCartNumber = int64(obj.Number)
|
|
resp.ShoppingCartNumber = int64(obj.Number)
|
|
resp.IsBeyondMaxLimit = false // 查询sku
|
|
fmt.Println(" increase handler >>>>>> ", resp)
|
|
return err
|
|
}
|