From d717e46d78e031af7fa3d310f5e4700a645b1355 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Tue, 5 Sep 2023 18:38:55 +0800 Subject: [PATCH] fix --- .../product/internal/logic/gettagproductlistlogic.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/product/internal/logic/gettagproductlistlogic.go b/server/product/internal/logic/gettagproductlistlogic.go index 40fa4a94..53300443 100644 --- a/server/product/internal/logic/gettagproductlistlogic.go +++ b/server/product/internal/logic/gettagproductlistlogic.go @@ -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查询尺寸