From c34811df833c4b8c67a864b1fd86855b769ffeb9 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Fri, 22 Sep 2023 17:21:40 +0800 Subject: [PATCH] fix --- server/shopping-cart/internal/logic/getcartslogic.go | 9 +++++---- server/shopping-cart/internal/types/types.go | 2 +- server_api/shopping-cart.api | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/server/shopping-cart/internal/logic/getcartslogic.go b/server/shopping-cart/internal/logic/getcartslogic.go index 45e5fa9e..1f798027 100644 --- a/server/shopping-cart/internal/logic/getcartslogic.go +++ b/server/shopping-cart/internal/logic/getcartslogic.go @@ -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, diff --git a/server/shopping-cart/internal/types/types.go b/server/shopping-cart/internal/types/types.go index ccda464c..366f7858 100644 --- a/server/shopping-cart/internal/types/types.go +++ b/server/shopping-cart/internal/types/types.go @@ -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 { diff --git a/server_api/shopping-cart.api b/server_api/shopping-cart.api index 86314683..89019534 100644 --- a/server_api/shopping-cart.api +++ b/server_api/shopping-cart.api @@ -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"` //分页信息