From affd0dc9bb8086d86b40101e33ccc1673740bd15 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 21 Sep 2023 14:41:20 +0800 Subject: [PATCH] fix --- .../internal/logic/getcartslogic.go | 21 ++----------------- server/shopping-cart/internal/types/types.go | 5 ++--- server_api/shopping-cart.api | 5 ++--- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/server/shopping-cart/internal/logic/getcartslogic.go b/server/shopping-cart/internal/logic/getcartslogic.go index c77ac8fa..0c498c9f 100644 --- a/server/shopping-cart/internal/logic/getcartslogic.go +++ b/server/shopping-cart/internal/logic/getcartslogic.go @@ -44,23 +44,7 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo if req.CurrentPage <= 0 { req.CurrentPage = constants.DEFAULT_PAGE } - //获取全部购物车id - allCratIds, count, err := l.svcCtx.AllModels.FsShoppingCart.GetAllCartsByParam(l.ctx, gmodel.GetAllCartsByParamReq{ - UserId: userinfo.UserId, - Fields: "id", - Sort: "id DESC", - Page: 1, - Limit: 1000, - }) - if err != nil { - logx.Error(err) - return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "system err:failed to get your shopping carts") - } - ids := make([]int64, 0, count) - for _, v := range allCratIds { - ids = append(ids, v.Id) - } - limit := 10 + limit := 300 //获取用户购物车列表 carts, total, err := l.svcCtx.AllModels.FsShoppingCart.GetAllCartsByParam(l.ctx, gmodel.GetAllCartsByParamReq{ UserId: userinfo.UserId, @@ -224,8 +208,7 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo CurrentPage: req.CurrentPage, PerPage: limit, }, - AllCartIdArray: ids, - CartList: list, + CartList: list, }) } diff --git a/server/shopping-cart/internal/types/types.go b/server/shopping-cart/internal/types/types.go index 6ae69b01..ed87d501 100644 --- a/server/shopping-cart/internal/types/types.go +++ b/server/shopping-cart/internal/types/types.go @@ -34,9 +34,8 @@ type GetCartsReq struct { } type GetCartsRsp struct { - Meta Meta `json:"meta"` //分页信息 - AllCartIdArray []int64 `json:"all_cartId_array"` //全部购物车id(不分页) - CartList []CartItem `json:"cart_list"` + Meta Meta `json:"meta"` //分页信息 + CartList []CartItem `json:"cart_list"` } type CartItem struct { diff --git a/server_api/shopping-cart.api b/server_api/shopping-cart.api index 19ec260b..5ab4f029 100644 --- a/server_api/shopping-cart.api +++ b/server_api/shopping-cart.api @@ -52,9 +52,8 @@ type GetCartsReq { CurrentPage int `form:"current_page"` //当前页 } type GetCartsRsp { - Meta Meta `json:"meta"` //分页信息 - AllCartIdArray []int64 `json:"all_cartId_array"` //全部购物车id(不分页) - CartList []CartItem `json:"cart_list"` + Meta Meta `json:"meta"` //分页信息 + CartList []CartItem `json:"cart_list"` } type CartItem { CartId int64 `json:"cart_id"`