fix
This commit is contained in:
@@ -124,11 +124,15 @@ func (l *GetProductListLogic) GetProductList(req *types.GetProductListReq, useri
|
||||
}
|
||||
//获取产品尺寸数量
|
||||
productSizeModel := gmodel.NewFsProductSizeModel(l.svcCtx.MysqlConn)
|
||||
productSizeCount, err := productSizeModel.CountByStatus(l.ctx, 1)
|
||||
productSizeCountList, err := productSizeModel.GetGroupProductSizeByStatus(l.ctx, productIds,1)
|
||||
if err != nil {
|
||||
logx.Error(err)
|
||||
return resp.SetStatusWithMessage(basic.CodeServiceErr, "get product size count err")
|
||||
}
|
||||
mapProductSizeCount := make(map[int64]int64)
|
||||
for _,v := range productSizeCountList{
|
||||
mapProductSizeCount[v.ProductId] = v.Num
|
||||
}
|
||||
//拼接返回
|
||||
itemList := make([]types.Items, 0, productLen)
|
||||
for _, v := range productList {
|
||||
@@ -138,6 +142,10 @@ func (l *GetProductListLogic) GetProductList(req *types.GetProductListReq, useri
|
||||
if !ok || !tmpOk {
|
||||
continue
|
||||
}
|
||||
sizeNum := int64(0)
|
||||
if mapSizeNum,ok := mapProductSizeCount[v.Id];ok{
|
||||
sizeNum = mapSizeNum
|
||||
}
|
||||
item := types.Items{
|
||||
Id: v.Id,
|
||||
Sn: *v.Sn,
|
||||
@@ -145,7 +153,7 @@ func (l *GetProductListLogic) GetProductList(req *types.GetProductListReq, useri
|
||||
Intro: *v.Intro,
|
||||
IsEnv: *v.IsProtection,
|
||||
IsMicro: *v.IsMicrowave,
|
||||
SizeNum: uint32(productSizeCount),
|
||||
SizeNum: uint32(sizeNum),
|
||||
MiniPrice: format.CentoDollar(minPrice),
|
||||
}
|
||||
//千人千面处理
|
||||
|
||||
Reference in New Issue
Block a user