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查询尺寸