fix
This commit is contained in:
parent
9f12f7035c
commit
ffd371d54c
@ -120,11 +120,21 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu
|
|||||||
logx.Error(err)
|
logx.Error(err)
|
||||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get template tags")
|
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get template tags")
|
||||||
}
|
}
|
||||||
|
//获取默认渲染的产品(写死)
|
||||||
|
productInfo, err := l.svcCtx.AllModels.FsProduct.FindOne(l.ctx, 30)
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "the product info is not exists")
|
||||||
|
}
|
||||||
|
logx.Error(err)
|
||||||
|
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get product info")
|
||||||
|
}
|
||||||
//资源id集合
|
//资源id集合
|
||||||
resourceIds := make([]string, 0, 5)
|
resourceIds := make([]string, 0, 5)
|
||||||
for _, v := range productTemplateTags {
|
for _, v := range productTemplateTags {
|
||||||
resourceIds = append(resourceIds, s3url_to_s3id.GetS3ResourceIdFormUrl(*v.Cover))
|
resourceIds = append(resourceIds, s3url_to_s3id.GetS3ResourceIdFormUrl(*v.Cover))
|
||||||
}
|
}
|
||||||
|
resourceIds = append(resourceIds, s3url_to_s3id.GetS3ResourceIdFormUrl(*productInfo.Cover))
|
||||||
//根据resourceUrls找到对应的元数据
|
//根据resourceUrls找到对应的元数据
|
||||||
resourceMetadataList, err := l.svcCtx.AllModels.FsResource.FindAllByResourceIds(l.ctx, resourceIds)
|
resourceMetadataList, err := l.svcCtx.AllModels.FsResource.FindAllByResourceIds(l.ctx, resourceIds)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -180,7 +190,9 @@ func (l *GetProductTemplateTagsLogic) GetProductTemplateTags(req *types.GetProdu
|
|||||||
CoverMetadata: mapResourceMetadata[*templateTagInfo.Cover],
|
CoverMetadata: mapResourceMetadata[*templateTagInfo.Cover],
|
||||||
Colors: colors,
|
Colors: colors,
|
||||||
SelectedColorIndex: SelectedColorIndex,
|
SelectedColorIndex: SelectedColorIndex,
|
||||||
ProductId: 30,
|
ProductId: productInfo.Id,
|
||||||
|
ProductCover: *productInfo.Cover,
|
||||||
|
ProductCoverMetadata: mapResourceMetadata[*productInfo.Cover],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return resp.SetStatusWithMessage(basic.CodeOK, "success", list)
|
return resp.SetStatusWithMessage(basic.CodeOK, "success", list)
|
||||||
|
@ -20,6 +20,8 @@ type GetProductTemplateTagsRsp struct {
|
|||||||
Colors [][]string `json:"colors"`
|
Colors [][]string `json:"colors"`
|
||||||
SelectedColorIndex int `json:"selected_color_index"`
|
SelectedColorIndex int `json:"selected_color_index"`
|
||||||
ProductId int64 `json:"product_id"`
|
ProductId int64 `json:"product_id"`
|
||||||
|
ProductCover string `json:"product_cover"`
|
||||||
|
ProductCoverMetadata interface{} `json:"product_cover_metadata"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetTemplateTagColorReq struct {
|
type GetTemplateTagColorReq struct {
|
||||||
|
@ -33,6 +33,8 @@ type GetProductTemplateTagsRsp {
|
|||||||
Colors [][]string `json:"colors"`
|
Colors [][]string `json:"colors"`
|
||||||
SelectedColorIndex int `json:"selected_color_index"`
|
SelectedColorIndex int `json:"selected_color_index"`
|
||||||
ProductId int64 `json:"product_id"`
|
ProductId int64 `json:"product_id"`
|
||||||
|
ProductCover string `json:"product_cover"`
|
||||||
|
ProductCoverMetadata interface{} `json:"product_cover_metadata"`
|
||||||
}
|
}
|
||||||
//根据模板标签跟logo还有选择颜色的索引获取颜色
|
//根据模板标签跟logo还有选择颜色的索引获取颜色
|
||||||
type GetTemplateTagColorReq {
|
type GetTemplateTagColorReq {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user