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