This commit is contained in:
laodaming
2023-08-21 10:21:02 +08:00
parent c47927d192
commit 6a912a145e
4 changed files with 25 additions and 2 deletions

View File

@@ -170,13 +170,20 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
}
}
//获取模板(只是获取产品product_id,id)
productTemplatesV2, err = l.svcCtx.AllModels.FsProductTemplateV2.FindAllByProductIds(l.ctx, productIds, "sort ASC", "product_id,id")
if req.TemplateTag != "" { //指定模板tag
productTemplatesV2, err = l.svcCtx.AllModels.FsProductTemplateV2.FindAllByProductIdsTemplateTag(l.ctx, productIds, req.TemplateTag, "sort ASC", "product_id,id")
} else { //没指定模板tag
productTemplatesV2, err = l.svcCtx.AllModels.FsProductTemplateV2.FindAllByProductIds(l.ctx, productIds, "sort ASC", "product_id,id")
}
if err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, "get product template_v2 err")
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to get product templates")
}
//只存第一个
for _, v := range productTemplatesV2 {
if _, ok := mapProductTemplate[*v.ProductId]; ok {
continue
}
mapProductTemplate[*v.ProductId] = v.Id
}
//获取产品尺寸数量

View File

@@ -249,6 +249,7 @@ type GetRecommandProductListRsp struct {
type GetTagProductListReq struct {
Cid int64 `form:"cid,optional"` //分类id
Size uint32 `form:"size,optional"` //尺寸
TemplateTag string `form:"template_tag,optional"` //模板标签
WithProduct bool `form:"with_product,optional"` //是否携带分类下的产品
}