fix
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"fusenapi/utils/basic"
|
||||
"fusenapi/utils/format"
|
||||
"fusenapi/utils/image"
|
||||
"fusenapi/utils/s3url_to_s3id"
|
||||
"gorm.io/gorm"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -73,16 +74,8 @@ func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRec
|
||||
ignoreProductIds = append(ignoreProductIds, v.Id)
|
||||
productIds = append(productIds, v.Id)
|
||||
mapRecommend[v.Id] = struct{}{}
|
||||
coverSlice := strings.Split(*v.Cover, "/")
|
||||
coverImgSlice := strings.Split(*v.CoverImg, "/")
|
||||
lenCoverSlice := len(coverSlice)
|
||||
lenCoverImgSlice := len(coverImgSlice)
|
||||
if lenCoverSlice > 1 {
|
||||
resourceIds = append(resourceIds, coverSlice[lenCoverSlice-1])
|
||||
}
|
||||
if lenCoverImgSlice > 1 {
|
||||
resourceIds = append(resourceIds, coverImgSlice[lenCoverImgSlice-1])
|
||||
}
|
||||
resourceIds = append(resourceIds, s3url_to_s3id.GetS3ResourceIdFormUrl(*v.Cover))
|
||||
resourceIds = append(resourceIds, s3url_to_s3id.GetS3ResourceIdFormUrl(*v.CoverImg))
|
||||
}
|
||||
//小于请求的数量则需要从产品表中随机填补上(不包含上面的产品)
|
||||
lenRecommendProduct := len(recommendProductList)
|
||||
@@ -139,11 +132,7 @@ func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRec
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product tag property")
|
||||
}
|
||||
for _, v := range productTagPropList {
|
||||
coverSlice := strings.Split(*v.Cover, "/")
|
||||
lenCoverSlice := len(coverSlice)
|
||||
if lenCoverSlice > 1 {
|
||||
resourceIds = append(resourceIds, coverSlice[lenCoverSlice-1])
|
||||
}
|
||||
resourceIds = append(resourceIds, s3url_to_s3id.GetS3ResourceIdFormUrl(*v.Cover))
|
||||
}
|
||||
//根据resourceUrls找到对应的元数据
|
||||
resourceMetadataList, err := l.svcCtx.AllModels.FsResource.FindAllByResourceIds(l.ctx, resourceIds)
|
||||
@@ -161,11 +150,6 @@ func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRec
|
||||
}
|
||||
mapTagProp := make(map[int64][]types.CoverDefaultItem)
|
||||
for _, v := range productTagPropList {
|
||||
coverSlice := strings.Split(*v.Cover, "/")
|
||||
lenCoverSlice := len(coverSlice)
|
||||
if lenCoverSlice > 1 {
|
||||
resourceIds = append(resourceIds, coverSlice[lenCoverSlice-1])
|
||||
}
|
||||
mapTagProp[*v.ProductId] = append(mapTagProp[*v.ProductId], types.CoverDefaultItem{
|
||||
Tag: v.TemplateTag,
|
||||
Cover: *v.Cover,
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"fusenapi/utils/basic"
|
||||
"fusenapi/utils/format"
|
||||
"fusenapi/utils/image"
|
||||
"fusenapi/utils/s3url_to_s3id"
|
||||
"gorm.io/gorm"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -180,16 +181,8 @@ func (l *GetTagProductListLogic) getProductRelationInfo(req getProductRelationIn
|
||||
productIds := make([]int64, 0, len(productList))
|
||||
for _, product := range productList {
|
||||
productIds = append(productIds, product.Id)
|
||||
coverSlice := strings.Split(*product.Cover, "/")
|
||||
coverImgSlice := strings.Split(*product.CoverImg, "/")
|
||||
lenCoverSlice := len(coverSlice)
|
||||
lenCoverImgSlice := len(coverImgSlice)
|
||||
if lenCoverSlice > 1 {
|
||||
resourceIds = append(resourceIds, coverSlice[lenCoverSlice-1])
|
||||
}
|
||||
if lenCoverImgSlice > 1 {
|
||||
resourceIds = append(resourceIds, coverImgSlice[lenCoverImgSlice-1])
|
||||
}
|
||||
resourceIds = append(resourceIds, s3url_to_s3id.GetS3ResourceIdFormUrl(*product.Cover))
|
||||
resourceIds = append(resourceIds, s3url_to_s3id.GetS3ResourceIdFormUrl(*product.CoverImg))
|
||||
}
|
||||
//获取商品可选配件
|
||||
productOptionalPartList, err = l.svcCtx.AllModels.FsProductModel3d.GetGroupPartListByProductIds(l.ctx, productIds)
|
||||
@@ -213,11 +206,7 @@ func (l *GetTagProductListLogic) getProductRelationInfo(req getProductRelationIn
|
||||
return nil, errors.New("failed to get product tag property")
|
||||
}
|
||||
for _, v := range productTagPropList {
|
||||
coverSlice := strings.Split(*v.Cover, "/")
|
||||
lenCoverSlice := len(coverSlice)
|
||||
if lenCoverSlice > 1 {
|
||||
resourceIds = append(resourceIds, coverSlice[lenCoverSlice-1])
|
||||
}
|
||||
resourceIds = append(resourceIds, s3url_to_s3id.GetS3ResourceIdFormUrl(*v.Cover))
|
||||
}
|
||||
//根据resourceUrls找到对应的元数据
|
||||
resourceMetadataList, err := l.svcCtx.AllModels.FsResource.FindAllByResourceIds(l.ctx, resourceIds)
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"fusenapi/utils/auth"
|
||||
"fusenapi/utils/basic"
|
||||
"fusenapi/utils/format"
|
||||
"fusenapi/utils/s3url_to_s3id"
|
||||
"gorm.io/gorm"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -95,16 +96,8 @@ func (l *HomePageRecommendProductListLogic) HomePageRecommendProductList(req *ty
|
||||
productIds := make([]int64, 0, len(recommendProductList))
|
||||
for _, product := range recommendProductList {
|
||||
productIds = append(productIds, product.Id)
|
||||
coverSlice := strings.Split(*product.Cover, "/")
|
||||
coverImgSlice := strings.Split(*product.CoverImg, "/")
|
||||
lenCoverSlice := len(coverSlice)
|
||||
lenCoverImgSlice := len(coverImgSlice)
|
||||
if lenCoverSlice > 1 {
|
||||
resourceIds = append(resourceIds, coverSlice[lenCoverSlice-1])
|
||||
}
|
||||
if lenCoverImgSlice > 1 {
|
||||
resourceIds = append(resourceIds, coverImgSlice[lenCoverImgSlice-1])
|
||||
}
|
||||
resourceIds = append(resourceIds, s3url_to_s3id.GetS3ResourceIdFormUrl(*product.Cover))
|
||||
resourceIds = append(resourceIds, s3url_to_s3id.GetS3ResourceIdFormUrl(*product.CoverImg))
|
||||
}
|
||||
//获取商品可选配件
|
||||
productOptionalPartList, err = l.svcCtx.AllModels.FsProductModel3d.GetGroupPartListByProductIds(l.ctx, productIds)
|
||||
@@ -172,11 +165,7 @@ func (l *HomePageRecommendProductListLogic) HomePageRecommendProductList(req *ty
|
||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product tag property")
|
||||
}
|
||||
for _, v := range productTagPropList {
|
||||
coverSlice := strings.Split(*v.Cover, "/")
|
||||
lenCoverSlice := len(coverSlice)
|
||||
if lenCoverSlice > 1 {
|
||||
resourceIds = append(resourceIds, coverSlice[lenCoverSlice-1])
|
||||
}
|
||||
resourceIds = append(resourceIds, s3url_to_s3id.GetS3ResourceIdFormUrl(*v.Cover))
|
||||
}
|
||||
//根据resourceUrls找到对应的元数据
|
||||
resourceMetadataList, err := l.svcCtx.AllModels.FsResource.FindAllByResourceIds(l.ctx, resourceIds)
|
||||
|
||||
Reference in New Issue
Block a user