This commit is contained in:
laodaming 2023-09-05 18:38:55 +08:00
parent 9258d66372
commit d717e46d78

View File

@ -276,12 +276,12 @@ func (l *GetTagProductListLogic) getProductRelationInfo(req getProductRelationIn
logx.Error(err)
return nil, errors.New("failed to get product templates")
}
mapModelId := make(map[int64]struct{})
mapDefaultModelId := make(map[int64]struct{})
for _, v := range productTemplatesV2List {
//标签符合不为空且遍历等于传入的模板标签
if *v.TemplateTag == req.TemplateTag {
if *v.TemplateTag == req.TemplateTag && req.TemplateTag != "" {
req.MapProductTemplate[*v.ProductId] = v.Id
mapModelId[*v.ModelId] = struct{}{}
mapDefaultModelId[*v.ModelId] = struct{}{}
continue
}
//如果已经有了则不用管
@ -289,11 +289,11 @@ func (l *GetTagProductListLogic) getProductRelationInfo(req getProductRelationIn
continue
} else { //否则设置一个值
req.MapProductTemplate[*v.ProductId] = v.Id
mapModelId[*v.ModelId] = struct{}{}
mapDefaultModelId[*v.ModelId] = struct{}{}
}
}
modelIds := make([]int64, 0, len(mapModelId))
for modelId, _ := range mapModelId {
modelIds := make([]int64, 0, len(mapDefaultModelId))
for modelId, _ := range mapDefaultModelId {
modelIds = append(modelIds, modelId)
}
//根据modelIds查询尺寸