This commit is contained in:
laodaming 2023-08-17 11:14:47 +08:00
parent 748b7e5b66
commit be95ff9d05
4 changed files with 5 additions and 5 deletions

View File

@ -5,7 +5,7 @@ import "context"
// TODO: 使用model的属性做你想做的
type GetTagPropByProductIdsWithProductTagRsp struct {
FsProductTagProp
Title string `json:"title"`
TemplateTag string `json:"template_tag"`
}
func (p *FsProductTagPropModel) GetTagPropByProductIdsWithProductTag(ctx context.Context, productIds []int64) (resp []GetTagPropByProductIdsWithProductTagRsp, err error) {
@ -14,7 +14,7 @@ func (p *FsProductTagPropModel) GetTagPropByProductIdsWithProductTag(ctx context
}
err = p.db.WithContext(ctx).Table(p.name+" as p ").
Joins("left join fs_product_template_tags as t on p.template_tag_id = t.id").
Select("p.*,t.title as title").
Select("p.*,t.template_tag as template_tag").
Where("p.product_id in (?) and p.status = ? and t.status = ?", productIds, 1, 1).
Find(&resp).Error
return resp, err

View File

@ -127,7 +127,7 @@ func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRec
mapTagProp := make(map[int64][]types.CoverDefaultItem)
for _, v := range productTagPropList {
mapTagProp[*v.ProductId] = append(mapTagProp[*v.ProductId], types.CoverDefaultItem{
Tag: v.Title,
Tag: v.TemplateTag,
Cover: *v.Cover,
})
}

View File

@ -138,7 +138,7 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
}
for _, v := range productTagPropList {
mapTagProp[*v.ProductId] = append(mapTagProp[*v.ProductId], types.CoverDefaultItem{
Tag: v.Title,
Tag: v.TemplateTag,
Cover: *v.Cover,
})
}

View File

@ -156,7 +156,7 @@ func (l *HomePageRecommendProductListLogic) HomePageRecommendProductList(req *ty
mapTagProp := make(map[int64][]types.CoverDefaultItem)
for _, v := range productTagPropList {
mapTagProp[*v.ProductId] = append(mapTagProp[*v.ProductId], types.CoverDefaultItem{
Tag: v.Title,
Tag: v.TemplateTag,
Cover: *v.Cover,
})
}