Merge branch 'develop' into feature/mhw-v1.01

This commit is contained in:
laodaming
2023-09-21 11:15:56 +08:00
19 changed files with 305 additions and 84 deletions

View File

@@ -44,6 +44,22 @@ 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
//获取用户购物车列表
carts, total, err := l.svcCtx.AllModels.FsShoppingCart.GetAllCartsByParam(l.ctx, gmodel.GetAllCartsByParamReq{
@@ -191,6 +207,7 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo
StepNum: stepQuantityList,
IsInvalid: false,
InvalidDescription: "",
IsHighlyCustomized: *cart.IsHighlyCustomized > 0,
}
//是否有失效的
if description, ok := mapCartChange[cart.Id]; ok {
@@ -206,7 +223,8 @@ func (l *GetCartsLogic) GetCarts(req *types.GetCartsReq, userinfo *auth.UserInfo
CurrentPage: req.CurrentPage,
PerPage: limit,
},
CartList: list,
AllCartIdArray: ids,
CartList: list,
})
}

View File

@@ -34,22 +34,24 @@ type GetCartsReq struct {
}
type GetCartsRsp struct {
Meta Meta `json:"meta"` //分页信息
CartList []CartItem `json:"cart_list"`
Meta Meta `json:"meta"` //分页信息
AllCartIdArray []int64 `json:"all_cartId_array"` //全部购物车id不分页
CartList []CartItem `json:"cart_list"`
}
type CartItem struct {
CartId int64 `json:"cart_id"`
ProductInfo ProductInfo `json:"product_info"` //产品信息
SizeInfo SizeInfo `json:"size_info"` //尺寸信息
FittingInfo FittingInfo `json:"fitting_info"` //配件信息
ItemPrice string `json:"item_price"` //单价
TotalPrice string `json:"total_price"` //单价X数量=总价
DiyInformation DiyInformation `json:"diy_information"` //diy信息
StepNum []int64 `json:"step_num"` //阶梯数量
PurchaseQuantity int64 `json:"purchase_quantity"` //当前购买数量
IsInvalid bool `json:"is_invalid"` //是否无效
InvalidDescription string `json:"invalid_description"` //无效原因
ProductInfo ProductInfo `json:"product_info"` //产品信息
SizeInfo SizeInfo `json:"size_info"` //尺寸信息
FittingInfo FittingInfo `json:"fitting_info"` //配件信息
ItemPrice string `json:"item_price"` //单价
TotalPrice string `json:"total_price"` //单价X数量=总价
DiyInformation DiyInformation `json:"diy_information"` //diy信息
StepNum []int64 `json:"step_num"` //阶梯数量
PurchaseQuantity int64 `json:"purchase_quantity"` //当前购买数量
IsHighlyCustomized bool `json:"is_highly_customized"` //是否高度定制
IsInvalid bool `json:"is_invalid"` //是否无效
InvalidDescription string `json:"invalid_description"` //无效原因
}
type ProductInfo struct {