This commit is contained in:
laodaming 2023-09-22 17:21:40 +08:00
parent 98bc6294e6
commit c34811df83
3 changed files with 7 additions and 6 deletions

View File

@ -43,12 +43,13 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo
}
currentPage := constants.DEFAULT_PAGE
limit := 300
if len(req.CartIds) > limit {
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "err param:request cart item is too much")
}
//获取用户购物车列表
var cartIds []int64
if req.CartId > 0 {
cartIds = append(cartIds, req.CartId)
}
carts, total, err := l.svcCtx.AllModels.FsShoppingCart.GetAllCartsByParam(l.ctx, gmodel.GetAllCartsByParamReq{
Ids: req.CartIds,
Ids: cartIds,
UserId: userinfo.UserId,
Sort: "id DESC",
Page: currentPage,

View File

@ -30,7 +30,7 @@ type DeleteCartReq struct {
}
type GetCartsReq struct {
CartIds []int64 `json:"cart_id,optional"` //购物车ids可选
CartId int64 `form:"cart_id,optional"` //购物车ids可选
}
type GetCartsRsp struct {

View File

@ -49,7 +49,7 @@ type DeleteCartReq {
//获取购物车列表
type GetCartsReq {
CartIds []int64 `json:"cart_id,optional"` //购物车ids可选
CartId int64 `form:"cart_id,optional"` //购物车ids可选
}
type GetCartsRsp {
Meta Meta `json:"meta"` //分页信息